def main():
    jobs = list(range(1, 6))
q = mp.Queue()
p = mp.Pool(None, f_init, [q])
results = p.imap(f, jobs)
p.close()
for i in range(len(jobs)):
    print(q.get())
print(next(results))
if __name__ == '__main__':
    main()
Can I use a multiprocessing Queue in a function called by Pool.imap?