title: Python Global Variable not updating
body: <p>I'm new with Python and programming but I can't seem to understand why this function does not update the global variable</p>
  <pre><code>global weight
  weight = 'value'
  def GetLiveWeight():
      SetPort()
      while interupt == False:
          port.write(requestChar2)
          liveRaw = port.read(9)
          liveRaw += port.read(port.inWaiting())
          time.sleep(0.2)
          weight = liveRaw.translate(None, string.letters)
      return weight
  </code></pre>
  <p>I also tried this:</p>
  <pre><code>weight = 'value'
  def GetLiveWeight():
      global weight
      SetPort()
      while interupt == False:
          port.write(requestChar2)
          liveRaw = port.read(9)
          liveRaw += port.read(port.inWaiting())
          time.sleep(0.2)
          weight = liveRaw.translate(None, string.letters)
      return weight
  
  try:
      threading.Thread(target = GetLiveWeight).start()
      print liveWeight
  except:
      print &quot;Error: unable to start thread&quot;
  </code></pre>