title: python threading with global variables
body: <p>i encountered a problem when write python threading code, that i wrote some workers threading classes, they all import a global file like sharevar.py, i need a variable like regdevid to keep
  tracking the register device id, then when one thread change it's value, then other threads can 
  get it fresh, but the result is that: when one thread change it's value, the others still get the default value i defined in sharevar.py file, why?
  anything wrong with me?</p>
  
  <pre><code># thread a
  from UserShare import RegDevID
  import threading
  class AddPosClass(threading.Thread):
  global commands
  # We need a pubic sock, list to store the request
  def __init__(self, queue):
      threading.Thread.__init__(self)
      self.queue = queue
  
  def run(self):
      while True:
          data = self.queue.get()
          #print data
          RegDevID = data
          #print data
          send_queue.put(data)
          self.queue.task_done()
  # thread b
  import threading
  from ShareVar import send_queue, RegDevID 
  """
  AddPos -- add pos info on the tail of the reply
  """
  class GetPosClass(threading.Thread):
      global commands
      # We need a pubic sock, list to store the request
      def __init__(self, queue):
          threading.Thread.__init__(self)
          self.queue = queue
  
      def run(self):
          while True:
              data = self.queue.get()
              #print data
              data = RegDevID
              #print data
              send_queue.put(data)
              self.queue.task_done()
  # ShareVar.py
  RegDevID = '100'
  </code></pre>
  
  <p>That's it, when thread a changed the RegDevID, thread b still get it's default value.
  Thanks advanced.</p>
  
  <pre><code>    from ShareVar import RegDevID
  
  class Test():
      def __init__(self):
          pass
      def SetVar(self):
          RegDevID = 999
      def GetVar(self):
          print RegDevID
  
  if __name__ == '__main__':
      test = Test();
      test.SetVar()
      test.GetVar()
  </code></pre>
  
  <p>The ShareVar.py:</p>
  
  <pre><code>RegDevID = 100
  </code></pre>
  
  <p>The result:</p>
  
  <pre><code>100
  </code></pre>
  
  <p>why?</p>