Check if a process exists with a given pid in Python September 1, 2020 import psutil pid = 12345 if psutil.pid_exists(pid): print("a process with pid %d exists" % pid) else: print("a process with pid %d does not exist" % pid) References https://stackoverflow.com/questions/568271/how-to-check-if-there-exists-a-process-with-a-given-pid-in-python Related