I have a python script that constantly runs in the background and writes it's output to a file, I have initialized it using Python.h class in c++.
I want to read from the file when the user make an action, therefore i need to somehow pause or stop the python script.
I would like to know if there is a way of sending c++ pointers to the python function and stopping the script by changing the object in the c++ code.
Or maybe force the script to stop.
Thanks, Ori.
You can force the script to stop using this line of code
system("pkill -f name-of-the-python-script"); in the c++ program.
You can also use the c++ program to write in another file and check it in every iteration in the python script. If
it's empty continue, otherwise: sys.exit() but don't forget to import sys
How to stop/pause an python script embedded in c++