In python2.7, multiprocessing.Queue throws a broken error when initialized from inside a function. I am providing a minimal example that reproduces the problem.
With a delay using time.sleep(0.1) as suggested by @HarryPotFleur, this problem is solved. However, I tested the code with python3 and the broken pipe issue does not happen at all in python3. I think this was reported as a bug and later got fixed.