import time from multiprocessing import Pool # can also work with ThreadPool, by importing # from multiprocessing.dummy import Pool def f1(a,b): print("run f1(%s,%s)" % (a,b)) time.sleep(2) print("end f1") return a*b def f2(a,b): print("run f2(%s,%s)" % (a,b)) time.sleep(3) print("end f2") return a+b if __name__ == '__main__': p = Pool(10) res_f1 = p.apply_async(f1, args=(5,4)) res_f2 = p.apply_async(f2, args=(5,4)) p.close() p.join() print(res_f1.get(), res_f2.get())