I wrote a Python script that goes forever in a while true loop and runs other Python scripts by interval like this:
while True:
now = time.time()
for command in self.commands:
if (command.last_called_timestamp + command.interval) < now:
command.last_called_timestamp = now
command.run_command_parallel()
time.sleep(0.1)
And the run_command_parallel method is like this:
def run_command_parallel(self):
thread.start_new_thread(os.system, ("python some_other_script.py", ))
The script works fine for several days. However, after 3-4 days I always receive an error from some random print statement of scripts that run in separate threads: "[WinError 233] No process is on the other end of the pipe". The script with the while loop also gets terminated. Any idea on why I receive this error and why the script with the while loop gets terminated? Or an alternative solution that can work in Python (without using batches or windows task schedulers)?