On Sat, Dec 06, 2003 at 01:18:38AM -0500, Graham Fawcett wrote: > Attached is a utility module that lets you "wrap" a PTL module in a proxy > that will reload itself automatically if the source file changes. If you use 'from ... import ...' then just reloading the module doesn't work too well. This is what I have been using: def reload_module(fullname): module = sys.modules[fullname] old_items = module.__dict__.items() reload(module) objects = {} # [(old_id, new_object)] for name, value in old_items: if name in module.__dict__: if name.startswith('_'): continue new_value = module.__dict__[name] if new_value is not value: objects[id(value)] = new_value for module in sys.modules.values(): if not hasattr(module, '__dict__'): continue for name, value in module.__dict__.items(): if id(value) in objects: print 'updating', getattr(module, '__name__'), name setattr(module, name, objects[id(value)]) objects.clear() To use it, I created a form that takes 'fullname' as a query string. I have my editor configured to that hitting a key causing the module I'm currently editing to be reloaded. It's not perfect but seems to work okay. Neil