I'm new to programing and I'm writing my first python program using quickly. I have added new window and on this new window I want to call function from main window? I google for it and all I found is that I nned to import it but it didnt know how.
Here is what I put new window:
from magic_ebay.MagicEbayWindow import MagicEbayWindow
and I get error:
ImportError: cannot import name MagicEbayWindow
MagicEbayWindow.py is the name of main window in my program and I want to call function from MagicEbayWindow.py but on other window. ( dont know if it make any sense :) )
Thanks for any help!
When you run:
You are essentially saying "Please import the
MagicEbayWindow
symbol from theMagicEbayWindow
module in themagic_ebay
package". The error message indicates that yourMagicEbayWindow.py
module doesn't have such a symbol.There are a few ways you could fix this:
Just import the module:
You can then access functions within the module as e.g.
MagicEbayWindow.foo()
Import individual functions from the module:
With this style, you can call the functions without the module name prefix.