import sys import os import requests import time import subprocess sys.path.append(os.getcwd()) proc = subprocess.Popen([".venv/bin/python", "app.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) time.sleep(25) if proc.poll() is not None: print("App crashed!") out, err = proc.communicate() print(err.decode()) else: print("App running successfully.") proc.kill()