re-importing modules

kyosohma at gmail.com kyosohma at gmail.com
Mon Apr 30 21:44:48 CEST 2007


On Apr 30, 12:49 pm, "T. Crane" <tcr... at REMOVETHISuiuc.edu> wrote:
> Hi,
>
> When troubleshooting code that's saved in a text file, I often find that I
> want to make a change to it, re-save it, then reimport it.  However, just
> typing
>
> import myTestCode
>
> doesn't always seem to import the newer version.  Is it supposed to?  I find
> that right now I often have to close my iPython window, then reopen it and
> import my recently modified code.  I know this can't be the best way to do
> this, but I don't know what is.
>
> any suggestions/help welcome and appreciated,
> trevis

Hi,

Another person posted the same thing today. As with that person, you
probably need to use the reload() function. See this post for more
details:

http://www.python.org/search/hypermail/python-1993/0342.html

Mike




More information about the Python-list mailing list