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 :) )

Needs some context. You could parse parent structures to walk up from a child, pass in a pointer to the class instance (once it's abstracted it's actually a pointer to an instance), or make it a global. Do you have this in a ppa/github or something?
–
hbdgafJul 19 '12 at 20:48

1 Answer
1

You are essentially saying "Please import the MagicEbayWindow symbol from the MagicEbayWindow module in the magic_ebay package". The error message indicates that your MagicEbayWindow.py module doesn't have such a symbol.

There are a few ways you could fix this:

Just import the module:

from magic_ebay import MagicEbayWindow

You can then access functions within the module as e.g. MagicEbayWindow.foo()

Import individual functions from the module:

from magic_ebay.MagicEbayWindow import foo

With this style, you can call the functions without the module name prefix.

Ok I got it finally :) instead: from magic_ebay import MagicEbayWindow i did: import MagicEbayWindow and it work! now when i want to call function from MagicEbayWindow i need to do : mee = MagicEbayWindow.MagicEbayWindow() mee.foo(self) I might doing it all way around but it work for me for now! THANK YOU!
–
Majster-plJul 20 '12 at 21:00