Python Forum

Full Version: How to make app run only when process is aviable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi ! So i have script and i want it to run only when game process is aviable how do i make it.
What is game process ?

If you want to check executable exists, for example ls

from shutil import which

# check ls exists
cmd = which("ls")
if cmd:
    print("ls available, path:", cmd)
else:
    print("ls not available")
Output:
ls available, path: /bin/ls