Reloading a module

Fernando Pérez fperez528 at yahoo.com
Mon Sep 30 21:14:19 EDT 2002


Tom wrote:

> 
> I'm developing some python mini applets on a Mac (using os 9 and the
> 2.1.1 Python IDE), and I've found it impossible to delete and/or reload
> a module after making changes to the code during the
> debugging/verification process. Is there an easy and/or effective way to
> do this? If I execute:
> 
> del mymodule
> 
> and then execute a print dir(mymodule), it shows up as nonexistent.
> Then, when I execute:
> 
> import mymodule
> 
> followed by a print dir(mymodule), the changes do not show up.

In [1]: reload?
Type:           builtin_function_or_method
Base Class:     <type 'builtin_function_or_method'>
String Form:    <built-in function reload>
Namespace:      Python builtin
Docstring:
    reload(module) -> module

    Reload the module.  The module must have been successfully imported 
before.

cheers,

f.



More information about the Python-list mailing list