separate instances of modules
Greg Ewing
greg.ewing at compaq.com
Thu Oct 28 06:52:58 EDT 1999
Helge Hess wrote:
>
> Does anybody know how to create multiple 'module' instances with
> separate environments, eg:
>
> PyObject *c1 = Py_ImportAsNew("MyComponent.py");
> PyObject *c2 = Py_ImportAsNew("MyComponent.py");
Instead of using the import mechanism, you could manually
read and compile the file, then create a new module object
and execute the code with the module's dict as the globals.
Greg
More information about the Python-list
mailing list