How to access a class instance created in one module in another module?

Hi,

I have a query. I have two modules viz. MnSem5Main.py and MnCEMMain.py in
different folders.
I have created the below instances in MnSem5Main.py:

'app' , 'frame'
Please note 'app' instance created using wx.App and 'frame' using wx.Frame
built in classes.
I want to access these in MnCEMMain.py. How to access these instances?
  
Regards,
Sachindeo V Chavan

···

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Well, you can pass in references to the app and frame objects to MnCEMMain.py and do it that way. Or you could us PubSub, which is my preferred method. It’s in wx.lib.pubsub. There are various examples on the wxPython wiki and on my blog.

···

On Wed, Apr 28, 2010 at 4:20 AM, sachin sachin_chavan@yahoo.com wrote:

Hi,

I have a query. I have two modules viz. MnSem5Main.py and MnCEMMain.py in

different folders.

I have created the below instances in MnSem5Main.py:

‘app’ , ‘frame’

Please note ‘app’ instance created using wx.App and ‘frame’ using wx.Frame

built in classes.

I want to access these in MnCEMMain.py. How to access these instances?

Regards,

Sachindeo V Chavan

Mike Driscoll

Blog: http://blog.pythonlibrary.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Note that pubsub in wx.lib of wxPython 2.8, though it works well, is not as powerful as the new version, which can be downloaded separately from pubsub.sf.net and installed standalone (or within wx.lib to replace wx.lib.pubsub, both methods work). Robin has started process of upgrading wx.lib.pubsub to newest.

Oliver

···

On Thu, Apr 29, 2010 at 8:59 PM, Mike Driscoll mike@pythonlibrary.org wrote:

On Wed, Apr 28, 2010 at 4:20 AM, sachin sachin_chavan@yahoo.com wrote:

Hi,

I have a query. I have two modules viz. MnSem5Main.py and MnCEMMain.py in

different folders.

I have created the below instances in MnSem5Main.py:

‘app’ , ‘frame’

Please note ‘app’ instance created using wx.App and ‘frame’ using wx.Frame

built in classes.

I want to access these in MnCEMMain.py. How to access these instances?

Regards,

Sachindeo V Chavan

Well, you can pass in references to the app and frame objects to MnCEMMain.py and do it that way. Or you could us PubSub, which is my preferred method. It’s in wx.lib.pubsub. There are various examples on the wxPython wiki and on my blog.

Mike Driscoll

Blog: http://blog.pythonlibrary.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en