from time import sleep from multiprocessing import Process # a function that blocks for a moment def task(): # block for a moment sleep(1) # display a message print('task Process running for 1 second') sleep(10) print('task Process running for 11 second') # create a thread p = Process(target=task) # run the thread #p.start() # wait for the thread to finish print('Main thread after task process starts...') sleep(2) print('Main thread 2 seconds after task process starts...') sleep(5) print('Main thread waiting for the process after 4 seconds...') #p.join()