0

I know this question is being asked in many threads but so far I couldn't find proper solution. Below is my code:

Class A:
   def init(self):
      self.b = B() 
Class B:
   def init(self):
       ....

In the main function

d = mp.Manager().dict()
p = mp.Pool(initializer=init function, initargs=[d])

d holds the objects created by multiple processes. But when it runs, the variables inside the object are not shared between processes.

Please advice

python_interest
  • 874
  • 1
  • 9
  • 27

1 Answers1

0

Yes, that's one of the limitations of multiprocessing. Those literally are separate processes with separate address spaces. If you need to communicate between them, you need to use a queue or a socket.

Tim Roberts
  • 48,973
  • 4
  • 21
  • 30