I have a python function:
def a_function():
#do something
It takes a while to finish, How do I stop the next command in the while true loop from running until it finishes?
import time
def a_function():
#do something
while True:
a_function()
time.sleep(5)
Currently It just starts the function and starts the timer so the timer finishes before the function messing up my schedule for the function.
Python by default is single-threaded, and everything executes in order.
print("Hello")
time.sleep(1)
print("World")
'Hello' will print, then a second later 'World' will print. What I was describing just can't happen, I was probably misinterpreting the issue.