Re-loading updated modules

Fredrik Lundh fredrik at pythonware.com
Tue Jun 27 15:29:58 CEST 2006


"fileexit" <mayyash at gmail.com> wrote:

> Shouldn't python recompile a module if there is a later version of the
> code (.py file)?

it does, when the module is first loaded.

> While i am debuging, i always have to exit python and
> delete the pyc before every run

deleting the PYC shouldn't be necessary.

> then start it again and import the
> modules.  It seems that this is the only way for it to recompile the
> new code.

reload(module)

however, see the caveats on this page:

    http://pyref.infogami.com/reload

> What is going on? is this normal behaviour?

yes.  and this is tutorial stuff, too:

    http://pytut.infogami.com/node8.html

</F> 






More information about the Python-list mailing list