I have two python scripts out of which one of them does some processing from the data in a excel file. The second script is used to update the data whenever the user updates the excel. After the user modifies the xlsx file he/she can run the second script and it automatically reloads the second script. However the problem here is that since the first script that does the actual processing is having a infinite while loop and when I am executing the file from the second script it doesn't exit after executing the first py file. I just want the second script to execute the first python file once and then exit out while the first script keeps executing infinitely. Here is the code:
import notification
import importlib
import subprocess
import os
import sys
importlib.reload(notification)
if os.name == 'nt':
subprocess.run(["python","notification.py"], capture_output=True)
else:
subprocess.run(["python3","notification.py"], capture_output=True)
sys.exit(0)
Here the name of my first file is notification.py.