Reloading code without shutting down the app

Cameron Laird claird at
Tue Sep 24 17:56:11 EDT 2002

In article <3nipma.itu.ln at cvs>,
Max Ischenko  <max at> wrote:
>Does python have some ways to reload source code of already running
>modules? For example, when consumer recv. a SIGHUP it would delete
>currently used objects/classes/modules, import all again, creates objects
>and continues to process the data from the Queue.
>Is it possible? And how?
The easy part is importing new stuff; read up on
eval and exec.

It takes more subtlety to "delete currently used
objects/classes/modules".  Easiest is to rewrite
your existing work slightly so it has enough self-
knowledge either to allow itself to be overwritten,
or to announce that it should be deleted.  Can you
make those changes?

Cameron Laird <Cameron at>

More information about the Python-list mailing list