How do I unload (reload) a Python module?

Posted by Mark Harrison on Stack Overflow See other posts from Stack Overflow or by Mark Harrison
Published on 2009-01-13T00:33:36Z Indexed on 2010/05/08 16:58 UTC
Read the original article Hit count: 234

Filed under:
|
|
|

I have a long-running python server and would like to be able to upgrade a service without restarting the server. What's the best way do do this?

if foo.py has changed:
    unimport foo  <-- how do I do this?
    import foo
    myfoo=foo.Foo()

© Stack Overflow or respective owner

Related posts about python

Related posts about import