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