from time import sleep import multiprocessing # a function that blocks for a moment def task(): print("first") q.put(1) q.get() print("third") q = multiprocessing.Queue() # create a process p = multiprocessing.Process(target=task) # run the process p.start() sleep(1) aa = q.get() print(f"Second, get {aa} from sub process") q.put(2) p.join()