-
-
Couldn't load subscription status.
- Fork 324
Loading and Unloading Python DLLs #434
-
I am writing a python script manager that needs to load/unload different python DLLs and virtual environments.
Doing a simple thing like PythonEngine.LoadDLL, UnloadDLL and then again LoadDLL gives me the "'There is already one instance of TPythonEngine running".
The only way I can get this to work is to add the "gPythonEngine := nil" line below into the following procuedure:
procedure TDynamicDll.UnloadDll;
begin
if IsHandleValid then begin
BeforeUnload;
FreeLibrary(FDLLHandle);
FDLLHandle := 0;
gPythonEngine := nil --> Added this line
end;
end;
IS this a bug or am I going about the process incorrectly?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
See Demo34, #287 and https://en.delphipraxis.net/topic/7721-if-i-changed-the-p4d-dllpath-how-to-reload-dlls
Beta Was this translation helpful? Give feedback.