unloading imported modules
Alex Martelli
aleax at aleax.it
Sat Jul 20 16:02:28 EDT 2002
xeon wrote:
> Hi,
>
> Is it possible in python intepreter to unload imported modules? or are
No.
> there ways to refresh the loaded functions if ever the module is
> updated, other than restarting the intepreter?
reload(moduleobject) updates the module object. If you use
statement import, that's all you need to do to "refresh the
loaded functions" (unless you've bound other identifiers to
the function objects). If you use statement from, you're SOL:
from x import y DOES bind identifier y to object x.y, and
after that there's no automatic refreshing. Solution: don't
use statement from -- use statement import and be happy.
Alex
More information about the Python-list
mailing list