Python Multithreading in UE4

I’m creating a plugin in C++ and calling a Python script from my C++ code. This is working fine for the most part, but my python script was using the joblibs library to parallelize a certain task, and UE4 seems to hate that. Whenever it gets to that part of the code, the editor freezes permanently and a new instance of the editor starts up and asks me what project I want to open. There’s no output in the logs after that point either. This is also happening with the multiprocessing library in Python, so it’s starting to seem like UE4 just doesn’t like Python multithreading. Is there a setting somewhere that I’ve missed that will let me do what I’m trying to do, or is this just not possible with UE4’s current Python plugin?

Well, I fixed my specific problem. In case anyone else comes across an issue like this, what worked for my was changing the parallel_backend of the Parallel class of the joblib module to ‘threading’. I think by default it’s on ‘loky’, which UE4 seems to not like.

1 Like