Closed
Description
Environment
- Pythonnet version: 2.3.0
- Python version: 3.6
- Operating System: Windows 10
Details
I am embedding Python using PythonEngine.Exec to run code read from a file which seems to be losing global scope.
string code;
using (var streamReader = new StreamReader(scriptFile, Encoding.UTF8)) {
code = streamReader.ReadToEnd();
}
using (Py.GIL()) {
PythonEngine.Exec(code)
}
The python code contains two classes:
class Test1():
pass
class Test2():
def __init__(self):
Test1()
Test2()
Error:
NameError: name 'Test1' is not defined
Metadata
Metadata
Assignees
Labels
No labels