Wait for a subprocess to start
15:22 30 Aug 2024

When I start Davinci Resolve, while it is loading it starts a subprocess called Resolve.enter image description here

Then when it finishes loading, this sub-process closes and opens another called Project Manager. enter image description here

import subprocess
import time
import psutil


for proc in psutil.process_iter(['pid', 'name']):
    if proc.info['name'] == process_name:
        return True
return False

print(“Waiting for the 'Project Manager to open' sub-process”)
while not is_process_running("Project Manager.exe"):
    time.sleep(1)  # Aguarda 1 segundo antes de verificar novamente

print("Subprocess 'Project Manager' open ")

However, there is something wrong with the code, and I have no idea what it is.

I've tried using psutil, but I don't know if it's really necessary to do what I want, or if there are internal Windows commands that can do it properly.

Also, is there a faster and more reliable way to check if the Project Manager subprocess has been opened and try to check again than using time.sleep(1)?

python windows subprocess