I want to keep the loop conditional statement running, but do not always check the conditions.
For example, if the condition is true, then in the next 3 seconds, the loop's conditional statement will run, and then check the condition after the 3rd second, then repeat this process.
I don't want to wait or sleep for three seconds, I want my loop to do work for three seconds. And then check if it should continue for another three as mentioned by @RemcoGerlich
while if_active() == True: #check the condition every 3 seconds`
try: # it will keep running in 3 seconds if if_active() is true
with open(masterpath, 'r') as f:
s = f.read()
exec(s)