Scheduling on the Raspberrypi

Hello,
I have two python scripts.
The first script is used to process images.
The second script has a function interrupt. If the user pushes the button the interrupt picks up the signal and takes pictures.

I want to do a scheduling between the two scripts.
The raspberry executes the first script but if the interrupt of the other script picks up a signal, the raspberry must stop the execution of the second script until the first script finishes its task.

Can you help me to do that please? Have you any idea ??

Thank you in advance

I think the better way to do that is to use lock file. They are empty file into /var/lock/. Create the file /var/lock/py_script1 when you start and delete it to make a signal when there are a problem.

The other way is to make a main python program who manage the 2 script into thread. It’s can be a little bit tricky.