title: Object method as multiprocessing.Process target
body: <p>I'm tinkering with threads, could someone shed some light about what's going on here?</p>
  
  <pre><code>from multiprocessing import Process
  from time import sleep
  
  class Thing(object):
      def __init__(self):
          print "__init__:", id(self)
          self.a = 100
          self.b = 200
  
    def run(self):
        while True:
            sleep(5)
            print id(self.a), self.a, '*', id(self.b), self.b
  </code></pre>
  
  <p>I then open up this script via <code>python -i</code> and do:</p>
  
  <pre><code>t = Thing()
  p = Process(target=t.run)
  p.start()
  # Thread starts running and reporting IDs every 5 seconds
  
  # if I do..
  t.a = 500
  
  # The address of `t.a` changes (using `id()`) and the thread still reports 100.
  </code></pre>
  
  <p>I understand expecting that to work would mean some really sketchy thread communication, but it looks like at some point there are two Thing() objects, the one available to me and the one inside the Process(). When does it get copied?</p>
  
  <p>And most important:</p>
  
  <p>How could I change the value of <code>self.a</code> INSIDE the <code>Process()</code>?</p>