Continuous loop using threading
Question: I am somewhat new to python. I have been trying to find the answer to this
coding question for some time. I have a function set up to run on a threading
timer. This allows it to execute every second while my other code is running.
I would like this function to simply execute continuously, that is every time
it is done executing it starts over, rather than on a timer. The reason for
this is that due to a changing delay in a stepper motor the function takes
different amounts of time run.


Answer: Is this what you're looking for?

    
    
    from threading import Thread
    
    def f():
        print('hello')
    
    while True:
        t = Thread(target=f)
        t.start()
        t.join()
    

Or maybe this, which shows the concurrent paths of execution (for production,
remove `sleep()` calls, of course):

    
    
    from threading import Thread
    from time import sleep
    
    def g():
        print('hello')
        sleep(1)
    
    def f():
        while True: g()
    
    Thread(target=f).start()
    sleep(1)
    print('other code here')
    

