I have a flask project and inside that project i have notification.py which i need it to run as long as the flask project is running. The docker is connected with flask and nginx.
i tried using the following codes but they didnt work:
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
notification_path = os.path.join(BASE_DIR,"notifications_script.py")
subprocess.Popen(['python', notification_path], shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
subprocess.run(['python', notification_path])
when i use subprocess.Popen it doesn't work and when i try using subprocess.run, the notifications_script start running but flask application doesnt work
if anyone can guide me into solving this problem, it will be great
Thank you