Reload an imported file

Felix Seeger seeger at sitewaerts.de
Wed Jun 12 13:15:38 CEST 2002


Ok, I have it.
For the people who search the archives or groups:

>> test.py
#! /usr/bin/python -O
import time
import importme
from importme import Tester

while 1:
        print Tester.test
        reload (importme)
        from importme import Tester
        print Tester.test
        time.sleep(3)

>> importme.py
#! /usr/bin/python -O

class Tester:

        test = 'test'

and this part:
        reload (importme)
        from importme import Tester
in the __init__ part of every class.

have fun
Felix



More information about the Python-list mailing list