[NCLUG] Reloading Python Module?

marciot marciot at holly.colostate.edu
Tue Aug 6 14:03:31 MDT 2002


Hi,

Here's the situation: I am using Python as an interactive
shell for a project I am doing. I have created a "foo.py"
file that is a library of functions I want to have
available. When I start out python I type "from foo import
*".

However, often I edit "foo.py" to add new functions as the
need arises. I would like to have python reload the module.
Apparently doing the "import" again does not reload it and
I end up having to quit python and restart it before the new
functions appear.

Is there an easier way? It would be awesome if I could have
python autodetect the modifications and reload the file for
me, but I'ld be satisfied if at least I could do it manually.

Marcio Luis Teixeira





More information about the NCLUG mailing list