I'm launching a programme with subprocess and follow that command with a for loop. The loop won't run until the programme I launched is closed. I don't understand why this is. Could someone please explain?
My Code:
import subprocess
import psutil
subprocess.call('/path_to/programme.exe')
for process in psutil.process_iter():
print(process)
I'm running Raspbian OS on a Pi 3 (armv7l).
Thanks for your time.
L
subprocess.call will wait until the command completes. Use subprocess.Popen instead.
This question is a duplicate of Non blocking subprocess.call