title: How to get the return value from a thread in Python?
body: <p>The function <code>foo</code> below returns a string <code>'foo'</code>. How can I get the value <code>'foo'</code> which is returned from the thread's target?</p>
  
  <pre><code>from threading import Thread
  
  def foo(bar):
      print('hello {}'.format(bar))
      return 'foo'
  
  thread = Thread(target=foo, args=('world!',))
  thread.start()
  return_value = thread.join()
  </code></pre>
  
  <p>The "one obvious way to do it", shown above, doesn't work: <code>thread.join()</code> returned <code>None</code>.</p>