import Python module in C# - multiple instances, not global/static for the class
Is there any way to import the same Python module as multiple instances, e.g. for each instance of C# class/object? For now it looks like the same module is imported for each instance of C# object (essentially a static Python object) when I do this: using (Py.GIL()) { dynamic syspy = Py.Import("sys"); syspy.path.append(ConfigDirectory); mymodulepy= Py.Import("mymodulepy"); }
After some thinking, the better solution is to wrap the python code into a class, so that each appropriate instance is called from C# side. On Mon, Oct 6, 2014 at 8:45 AM, Denis Akhiyarov <denis.akhiyarov@gmail.com> wrote:
Is there any way to import the same Python module as multiple instances, e.g. for each instance of C# class/object? For now it looks like the same module is imported for each instance of C# object (essentially a static Python object) when I do this:
using (Py.GIL()) { dynamic syspy = Py.Import("sys"); syspy.path.append(ConfigDirectory); mymodulepy= Py.Import("mymodulepy"); }
participants (1)
-
Denis Akhiyarov