reloading modules

Dustan DustanGroups at gmail.com
Wed Dec 6 08:00:28 EST 2006


Dustan wrote:
> aine_canby at yahoo.com wrote:
> > I'm using python.exe to execute my modules. I have a music.py module
> > which contains my classes and a main.py module which uses these
> > classes. In python.exe, I call "import main" to execute my program. The
> > problem is that I have to close python and reopen it everytime i change
> > music.py or main.py. What should I be doing.
> >
> > Thanks,
> >
> > Aine.
>
> >>> import main
> ### Execution Occurs ###
> >>> # You go off to edit your module
> >>> reload(main)
> ### Execution Occurs ###

I was obviously assuming that your module does something just by
importing, which may or may not be the case. Either way, whenever a
module may have been edited during a program's lifetime, it can be
reloaded using the reload function.




More information about the Python-list mailing list