[Python.NET] Reloading modules

Evan Davey evan.davey at ekidna-engineering.com
Sun Apr 16 21:27:21 EDT 2017


I am using Python.Net <http://python.net/> embedded inside an application.  The application allows me to select and run a python file (which then allows me to use Python to access that application's C# SDK).

string code;
using (var streamReader = new StreamReader(scriptFile, Encoding.UTF8))
    code = streamReader.ReadToEnd();

using (Py.GIL())

This works, except when the code imports a python module I have to quit and restart the application in order for the import to reflect any code changes (which is very slow for debugging).

How can I reload or reset the PythonEngine before running the code?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20170417/12705497/attachment.html>

More information about the PythonDotNet mailing list