Is automatic reload of a module available in Python?

Jean-Michel Pichavant jeanmichel at
Wed Feb 17 16:14:19 CET 2010

R (Chandra) Chandrasekhar wrote:
> Dear Folks,
> I am currently developing a python program, let us call it 
> "", and I am testing out the functions therein by testing 
> them out interactively in the python interpreter by invoking python 
> and doing
> import generic
> Once I hit an error, I need to revise my file and reload the module using
> reload(generic)
> The difference in syntax between invoking import and reload is really 
> costing me time and patience.
> Therefore, I would like to ask:
> 1. Is there a method of auto-reloading a module while developing it 
> and testing it with the interactive python interpreter?
> 2. Is there a better way of developing a program?
> Thank you.
> Chandra
You will always find people explaining to you how it can be possible if 
you really know precisely how python object model works. If you actually 
do, you can possibly read their technics.
But my short answer would be "No, there is no reliable way to reload a 

Still there is 'reload' builting function you can call on any module, by 
you must understand that it won't affect any other object that the 
module itself. New objects created from that module will take effects, 
but all objects created before won't.


More information about the Python-list mailing list