I execute a process (using Popen) and after a while, this process executes a child process.
What I'm trying to do is wait for the child process to be spawned and then continue executing my script.
The only way that I found, is using psutil and polling until the process has children.
process = psutil.Process(subprocess.Popen(command).pid)
while 0 == len(process.children()):
time.sleep(0.2)
Is there a better way of doing it than polling on the children? Maybe waiting for some event?
I'm using windows 10 for this.