reloading my own modules

Lowell Kirsh lkirsh at
Tue Jun 7 05:45:28 CEST 2005

I have a driver module as well as several other modules. I am running 
the driver interactively from emacs - that is, I don't restart python on 
each run. I want to work it such that every time a modify the source for 
one of the non-driver modules and re-run the driver, the other modules 
will be reloaded. I have the following at the top of my driver module:

import dbtest, util
for module in ['dbtest', 'util']:
     if module in sys.modules.keys():

Is this the best way to do it? It seems a bit verbose, but not really 
all that bad. I was just wondering if there is a more standard way to do it?


More information about the Python-list mailing list