I have a function a doing some tasks and another function b being a callback to some events. Whenever an event happens, function b is called and I would like to make it able to interrupt the execution of function a. Both functions are declared inside the same class.
Function a is not supposed to call function b. Function b is totally independent, it is a callback to an external event like "user face detected" coming from ROS: robot operating system.
what I need is basically something like Ctrl+C that can be called from within Python and which only aborts a targeted function and not the whole program.
Can this be done in Python?