On 6 Mar 2007 10:58:14 -0800, Martin Unsal <[EMAIL PROTECTED]> wrote: > On Mar 6, 10:13 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > You have to reload the importing module as well as the module that > > changed. That doesn't require rewriting the import infrastructure. > > As far as I can tell, the moment you use "from foo_module import bar", > you've broken reload(). Reloading higher level packages doesn't help. > The only practical solution I can see is to rewrite __import__ and > reload. >
Example: a.py AExport = object() b.py from a import AExport class Object(object): pass BExport = Object() BExport.a = AExport interpreter session: >>> import b >>> b.AExport <object object at 0x009804A8> >>> b.BExport.a <object object at 0x009804A8> >>> import a >>> a.AExport <object object at 0x009804A8> >>> "changed a.py such that AExport = list()" 'changed a.py such that AExport = list()' >>> reload(b) <module 'b' from 'b.pyc'> >>> b.AExport <object object at 0x009804A8> >>> "note no change" 'note no change' >>> reload(a) <module 'a' from 'a.py'> >>> b.AExport <object object at 0x009804A8> >>> "note still no change" 'note still no change' >>> reload(b) <module 'b' from 'b.pyc'> >>> b.AExport [] >>> "now its changed" 'now its changed' >>> b.BExport.a [] >>> -- http://mail.python.org/mailman/listinfo/python-list