# example of running a function in another thread from time import sleep from threading import Thread # a function that blocks for a moment def task(arg1, arg2): # block for a moment sleep(1) # display a message print("arg1=",arg1) print("arg2=",arg2) # create a thread thread = Thread(target=task, args=("One",2)) # run the thread thread.start() # wait for the thread to finish print('Waiting for the thread...') thread.join()