PierreC 1 Posted November 29, 2021 Hello, In my quest to integrate python scripting into my application, I encounter another problem. I have to use P4D in a kind of plugin of my Windows application, which forces me to instantiate and release the python library several times in the same process (but never simultaneously). This is not a problem except when some modules are imported. For example, if I import numpy or win32com, the second call to import triggers an exception: EPyTypeError for win32com, Access violation for numpy. Here is an ultra-simplified example of what I do: program LoadTwice; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, PythonEngine; var pythonEngine: TPythonEngine; begin pythonEngine:= TPyThonEngine.Create(nil); pythonEngine.LoadDll; pythonEngine.ExecString('import numpy'); pythonEngine.Free; pythonEngine:= TPyThonEngine.Create(nil); pythonEngine.LoadDll; pythonEngine.ExecString('import numpy'); pythonEngine.Free; end. Do you have any idea what I'm doing wrong? Share this post Link to post
PierreC 1 Posted November 29, 2021 I just discovered a post that details the same problem. It seems that multiple loading is not supported by P4D or rather by the python library. Sorry for the inconvenience. https://github.com/pyscripter/python4delphi/issues/287 1 Share this post Link to post