[python-uk] How to access a class instance created in one module in another module?

meitham meitham at meitham.com
Thu Apr 29 10:26:44 CEST 2010


> I have a query. I have two modules viz. MnSem5Main.py and MnCEMMain.py in
> different folders.
Make the two folders packages so you can import from them, just add an
empty __init__.py file in each folder.
> I have created the below instances in MnSem5Main.py:
>
> 'app'   ,  'frame'
> Please note that 'app' is created using wx.App and 'frame' using wx.Frame
> builtin classes.
> I want to access these in MnCEMMain.py. How to access these instances?
suppose the folder name where MnSem5Main.py is located called foo
from foo.MnSem5Main import app, frame


More information about the python-uk mailing list