wang frank wrote: > When I edit a module, I have to quit python and then restart python and > then import the module. Are there any way to avoid quit python to load an > updated module? When I am debugging a module code, I need to constantly > make changes. It is not convenient to quit and reload.
There is the reload() function, but it has pitfalls. Objects referenced from without the module are not updated: >>> open("tmp.py", "w").write(""" ... def f(): print "version one" ... """) >>> import tmp >>> tmp.f() version one >>> g = tmp.f >>> open("tmp.py", "w").write(""" ... def f(): print "version two" ... """) >>> reload(tmp) <module 'tmp' from 'tmp.py'> >>> tmp.f() version two >>> g() version one Peter -- http://mail.python.org/mailman/listinfo/python-list