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