Running scripted-cli prevents QProcess from finishing

I have a module where I periodically run an instance of a subclass of QProcess, which is basically identical to @pieper 's Process class in SlicerParallelProcessing.

I use this class to run a python script that polls an API in a server. When the process finishes, it gets destroyed and another one is called after 2 seconds (using a QTimer).

Everything works fine until I call a scripted cli module at some point. Basically, as soon as a scripted-cli module runs, the QProcess hangs - it does not emit the finished() signal anymore. The script runs fine without errors, I checked the standard output and no problem there. It just doesn’t finish.

It does not have anything to do with what the scripted-cli module does: it happens with my module or even the standard cli module produces by the Extension Wizard.

Note: the problem does not happen if your run a c++ cli module

I am not very familiar with the underlyings of PythonSlicer or QTClI, but I think it might have something to do with them.

Any idea?

CLI modules are run in independent threads, while python code runs in the main thread, so that may be the difference. If you are still having trouble try to create a minimal example that others can test with and help you debug.