Reload an imported file

Erik Max Francis max at alcyone.com
Wed Jun 12 14:20:42 EDT 2002


Felix Seeger wrote:

> I have a config file. This is a normal python file.
> Can I reimport this file during runtime ?
> So changing the configuration will not need a restart of my program.

Try the reload builtin.  Note, though, that this will not change the
state of objects already created, and it won't help if you did from
module import *.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Who'd ever think it / Such a squalid little ending
\__/ The American and Florence, _Chess_
    Church / http://www.alcyone.com/pyos/church/
 A lambda calculus explorer in Python.



More information about the Python-list mailing list