title: Is there a way to make a class add multiprocessing shared values?
body: <p>I have created a class where all the functions work and can be put into different processes and edited. All of the functions work except the add value function. This is my class:</p>
  <pre><code>class data(object):
  
  def __init__(self):
      Manager = multiprocessing.Manager()
      self.lock = multiprocessing.Lock()
      self.changeAmt = 0
      self.jump = multiprocessing.Value(ctypes.c_float, 0.02)
      self.has_best = multiprocessing.Value(ctypes.c_bool, False)
      self.best_list = Manager.list()
      self.command_original = 'start sequence'
      self.command = multiprocessing.Value(ctypes.c_wchar_p, self.command_original)
      self.get_best = multiprocessing.Value(ctypes.c_bool, False)
      self.done = multiprocessing.Value(ctypes.c_bool, False)
  
  def get(self, name, model):
      self.model = model
      if model != 'Array':
          with multiprocessing.Lock():
              exec('self.now = self.'+name)
              return self.now.value 
      if self.model == 'Array':
          exec('self.now = self.'+name)
          return self.now
  
  def edit(self, name, model, changeAmt):
      self.changeAmt = changeAmt
      if model != 'Array':
          with multiprocessing.Lock():
              exec('self.'+name+'.value = self.changeAmt')
      if model == 'Array':
          for i in range(len(changeAmt)):
              exec('self.'+name+'.append(changeAmt[i])')
  
  def addValue(self, name, value):
      self.now = value
      exec('self.'+name+' = self.now')
  </code></pre>
  <p>Which can then be used correctly with these lines of code in the main function:</p>
  <pre><code>ult = data()
  p1 = Process(target = try2, args=(ult,))
  p1.start()
  p2 = Process(target = nextTry, args=(ult,))
  p2.start()
  p1.join()
  p2.join()
  </code></pre>
  <p>When I go to use the addValue function in my code, the first process works great and can return the value when the get function is called. However, when I go to call the get function for the second process it fails. One of my ideas on a solution is to use the multiprocessing Queue method and have both processes add the value. Although, I have a feeling even if both functions have added the value it will not change if one of them changes the value. Is what I am trying to accomplish do-able, or should I just try to initialize all of my variables from the start?</p>