title: Python - Function isn't 'Global' and so can't be called within Threading Class
body: <p>So, first off here's my code:</p>
  
  <pre><code>import threading
  
  print "Press Escape to Quit"
  
  class threadOne(threading.Thread): #I don't understand this or the next line
      def run(self):
          setup()
  
      def setup():
          print 'hello world - this is threadOne'
  
  
  class threadTwo(threading.Thread):
      def run(self):
          print 'ran'
  
  threadOne().start()
  threadTwo().start()
  </code></pre>
  
  <p>So, the problem is that within my class 'threadOne' the run function runs (as that is called by the threading module) but from there I can not called any other functions.  That includes if I make more functions beneath the setup() function.  For example above, in my run(self) function I try and call setup() and get 'NameError: global name 'setup' is not defined'.</p>
  
  <p>Does anybody have any ideas or can they explain this to me?</p>
  
  <p>Sam</p>