python detect program code example
Example 1: how to check if an application is open in python
#Iterates through all the programs running in your system and checks for the one in the string
import psutil
"someProgram" in (p.name() for p in psutil.process_iter())
Example 2: python check if exe is running
import subprocess
s = subprocess.check_output('tasklist', shell=True)
if "cmd.exe" in s:
print s