0

I am currently working with C# and Python through PythonNet. It works well calling and using python functions from C#. However, the problem is when I tried to call python function in async condition by using multi-thread. As I googled so far, I found some issues that python has "GIL" so that it blocks multi-threading. Even that case, I can still call python function in async and use it if it was written in Built-in functions only in python, which means, it is not possible to use other library functions in python.

My questions,

  1. is there any other way to use mulit-threading in pythonNet
  2. why I can't import libraries in python when I tried in async
hanbi Kim
  • 1
  • 1

1 Answers1

0

According to pyhtonnet documentation

  • If you plan to use Python objects from multiple threads, also call
PythonEngine.BeginAllowThreads()

Source : https://github.com/pythonnet/pythonnet

Shah Meer
  • 11
  • 3