Marco Aschwanden wrote: > Load a module and hand in already the server_api. How can I achieve this?
Using execfile() is the simplest approach: import imp import sys def import_preloaded(name, path=None, variables={}): if path is None: file, path, description = imp.find_module(name) module = imp.new_module(name) module.__dict__.update(variables) execfile(path, module.__dict__) sys.modules[name] = module return module if __name__ == "__main__": demo = import_preloaded("demo", variables=dict(whatever=42)) I think you should consider a class instead of a module, though. Peter -- http://mail.python.org/mailman/listinfo/python-list