import psutil def is_process_running(process_name): pl = psutil.pids() for pid in pl: if psutil.Process(pid).name() == process_name: print(pid) print(psutil.Process(pid).cmdline()) # return True return False print(is_process_running('python.exe'))