If I have:
def EventCheck():
if cond_1 == True:
do small action
if cond_2 == True:
do small action
if cond_3 == True:
for i in range(20):
do longer action multiple times
if cond_4 == True:
do small action
if cond_5 == True:
do small action
while true:
eventCheck()
In my theoretical program normal flow control would be along the lines of fig. a in the picture
Is it possible to fork the actual control of the program so if a specific event evaluates as true it then branches of and runs its function while the rest of the program continues on as normal? As in Fig. b above.
In my main ‘event’ loop, I have a condition that is rarely ever true, but when it is, I need it to go off an perform a semi-long task. Right now, it of course takes control of the program so while condition A is running it’s code, none of the other main, frequently used events are able to be checked for.
Is this possible?

Check out multiprocessing.
If the longer task is I/O bound (instead of CPU) there are some other solutions, like event-driven / async libraries and threading. These don’t offer actual sequential code execution, but instead execute other code while I/O is being done. For a better understanding of choosing multiprocessing vs shared memory models like threading, read up on Python’s GIL.