Reloading modules into interpreter

Alex Martelli aleaxit at
Sun Aug 12 00:22:01 CEST 2001

"jsnyder" <jsnyder at> wrote in message
news:9l48os$dg3$1 at
> Hello, I'm a newbie at Python and the solution to the following seems to
> escape me at the moment:
> Running from Pythonwin, I am importing a module and then calling its
> Then I change the module code and run it again, but the old code still
> not the new code.  The only way I have been able to get the new code is to
> shut down the interpreter, restart it and reimport the module.  Surely
> is an easier way.

Of course!  The fifth little iconic button from the left, with the tooltip
"Import/Reload" and the status message "Import/reload a Python
module", will open a file-selection box where you indicate your
Python source file; if that's the first time you're importing it, it
does an import, else, a reload (import is a Python statement, reload
a built-in function).

But there's more!  If when you click this toolbar-button the current
MDI child-window in Pythonwin is one with a module being edited,
you don't even have the bother of the file-selection box -- it knows
the module you want to import or reload is specifically the one
in the current MDI child-window.  Nice, isn't it?-)


More information about the Python-list mailing list