I have a code to kill my application through task manager and it works successfully. However, now I want to first check if the program exists before it kills it, any suggestions?
def close_SAP()"
call('taskkill /im saplogon.exe /t /f')
if __name__ == '__main__':
close_SAP()