I'm trying to create a program that runs forever. It works correctly when run in the IDE, but only works once if I run it through .exe. And maybe someone knows a better way than checking the exe once every time
def process_exists(process_name):
for proc in psutil.process_iter(['name']):
if proc.info['name'] == process_name:
print(f"Process {process_name} found")
return True
print(f"Process {process_name} not found")
return False
def main():
while True:
try:
if not process_exists('Wow.exe'):
process_lua_file()
else:
process_lua_file()
except Exception as e:
print(f"An error occurred: {e}")
time.sleep(10)
if __name__ == '__main__':
main()