From: booncw on 6 Apr 2010 09:58 Hi, I am running a simulation where the python module has already been imported. Could you please tell me how to load it? I've been doing this (importing everytime), but it is too slow: pModule = PyImport_Import(pName); Yours, Boon
From: Christian Heimes on 8 Apr 2010 06:26 On 06.04.2010 15:58, booncw wrote: > Hi, > > I am running a simulation where the python module has already been > imported. Could you please tell me how to load it? > > I've been doing this (importing everytime), but it is too slow: > pModule = PyImport_Import(pName); You can cache the module object in a static variable: static PyObject *module = NULL; if (module == NULL && (module = PyImport_ImportModuleNoBlock("module")) == NULL) { return NULL; } } Christian
|
Pages: 1 Prev: pass object or use self.object? Next: Recommend Commercial graphing library |