import multiprocessing, time def f(i): print("asdasd") if i == "hihi": time.sleep(10) else: time.sleep(60) with multiprocessing.Pool(2) as p: p.map(f, ["uhuhu", "hihi", "hahaha", "asdsd", "sdasdsd"])