Refreshing imported modules

sykora sykora.skywave at gmail.com
Thu May 3 04:50:54 EDT 2007


On May 2, 7:24 pm, noagbodjivic... at gmail.com wrote:
> I have the python interperter opened while editing a module. The
> problem is that when I make changes, the module is not refreshed
> whenever I import it again. I have to re-launch the interpreter, is
> there a way to shortcut this?

I believe you can use the 'reload' command. ie

First import your module :
>>> import module_name


If you want to refresh the module after having changed it,
>>> module_name = reload(module_name)

That should work. However, any variables you have declared which arise
from classes within your module must be redeclared.




More information about the Python-list mailing list