Re: [python-uk] How to access a class instance created in one module in another module?
> 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 ___ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk
Re: [python-uk] How to access a class instance created in one module in another module?
On Wed, Apr 28, 2010 at 3:02 PM, Goodies wrote: > 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 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? Your terminology is a little muddled here. It sounds like what you mean is that you created classes called app and frame in MnSem5Main.py which subclass (or inherit from) wx.App and wx.Frame. if MnSem5Main.py is on your PYTHONPATH, you can import the classes by putting the following line in MnSem5Main.py: from MnSem5Main import app, frame Then you can create instances of the classes by calling them with the appropriate parameters. Even if app and frame are instances of classes instead of classes, the import statement will get them from the MnSem5Main namespace and put them in your namespace. xtian ___ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk
[python-uk] Reminder: 9th London Python Code Dojo next week
Folks, A quick reminder that the next London Python Code Dojo is a week away. It's on 6th May, starts at 6:30pm (coding at 7:30) and will be at the offices of Fry-IT (details at the end). You can sign up here (just so we know how much pizza to order): http://ldnpydojo.eventwax.com/9th-london-python-code-dojo We hope to get close to finishing the text-adventure game we've been writing by adding behaviour to objects and puzzles. Peter will start the evening with a quick recap on the Bayesian parser we "blessed" at the end of the last dojo and we'll work in teams as before. As always, free pizza and beer will be provided by Fry-IT (thanks!) and there is also a copy of "Natural Language Processing with Python" to win (thanks to O'Reilly). Look forward to seeing you there! Nicholas. Venue: Fry-IT Limited 503 Enterprise House 1/2 Hatfields London SE1 9PG Telephone: 0207 0968800 Nearest Tubes: Waterloo Southwark ___ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk