title: Creating Threads in python
body: <p>I have a script and I want one function to run at the same time as the other.</p>
  
  <p>The example code I have looked at:</p>
  
  <pre class="lang-py prettyprint-override"><code>import threading
  
  def MyThread (threading.thread):
      # doing something........
  
  def MyThread2 (threading.thread):
      # doing something........
  
  MyThread().start()
  MyThread2().start()
  </code></pre>
  
  <p>I am having trouble getting this working. I would prefer to get this going using a threaded function rather than a class.</p>
  
  <p>This is the working script:</p>
  
   <pre class="lang-py prettyprint-override"><code>from threading import Thread
  
  class myClass():
  
      def help(self):
          os.system('./ssh.py')
  
      def nope(self):
          a = [1,2,3,4,5,6,67,78]
          for i in a:
              print i
              sleep(1)
  
  
  if __name__ == "__main__":
      Yep = myClass()
      thread = Thread(target = Yep.help)
      thread2 = Thread(target = Yep.nope)
      thread.start()
      thread2.start()
      thread.join()
      print 'Finished'
  </code></pre>