You could always make a 4th module which reloads the 1st three :)

The other option would be to just put them all in one module - that's certainly 
not unprecedented and if you're not planning on reusing the components/modules 
individually might make the most sense.

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pigneri, Rocco
Sent: Tuesday, January 15, 2008 8:23 AM
To: users@lists.ironpython.com
Subject: [IronPython] Reloading Modules

Dear all,

While I know that this could be a more general Python question, since 
IronPython has its own interpreter, I thought that I should probably ask this 
question here in case it actually is IPy specific.  Also, I am new to Python so 
if there is a document somewhere that answers this question, I am more than 
happy to read it if someone points me to it.

So, the question.  I have a program that has multiple classes.  Since I have a 
C#/Java background, I have so far put all these classes in a separate file, and 
thus in a separate module.  They are organized like this:

- Main.py
calls
- ApplicationForm Class
which contains
- Widget Class

Main pretty much just creates a new ApplicatoinForm instance and displays it.  
ApplicationForm then has some Widget instances on it.  When I make a change to 
the Widgets, I find myself reloading the Widget module, then the 
ApplicationForm module, and then finally Main.py in order to have my changes 
reflected on the form.  However, I know that this is somewhat against the 
Python philosophy of dynamic changes while running a program.  Is there a 
better way to do this, or do I have to use this process because I'm using 
Windows Forms?  Also, if I do have to continue using this process, is there a 
quick one-liner that I could use to reload all my changes without having to 
reload each module by hand?

Thank you,

Rocco
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to