title: Trigger another function until it finishes first one
body: <p>I searched so many solutions in <code>stackoverflow</code>,<code>google</code> and i found nothing solution to my problem.I knew there are many questions like this but i didn't found any solution from that questions.</p>
  
  <p><strong>My Problem is:</strong></p>
  
  <p>I am writing a script in python which will call two different functions by using <code>threading</code> module.I need to call second function until first function is finished because i am downloading the data in first function and i have to use the same data in second function.I am storing the data in the form of list in a file.</p>
  
  <p><strong>My script for calling functions:</strong></p>
  
  <pre><code>def trigger_fiftyusers():
      try:
          for k in range(50):
  
              # calling first function
              syncUpFun = threading.Thread(target=func1)
              syncUpFun.start()
              syncUpFun.join()
  
              # calling second function
              syncDownFun = threading.Thread(target=func2)
              syncDownFun.start()
              syncDownFun.join()
  except Exception as error:
      print(error)
      print(traceback.format_exc())
  </code></pre>
  
  <p><strong>for example:</strong></p>
  
  <p>my first function is like:</p>
  
  <pre><code>def func1():
      list1=[]
      print "func1"
      # some code here
      list1.append("some data")
      return list1
  </code></pre>
  
  <p>my second function is like:</p>
  
  <pre><code>def func2():
      print "func2"
      # some code here for getting the data from func1
      return list1
  </code></pre>
  
  <p><strong>and output should be:</strong></p>
  
  <pre><code>func1
  func1
  func1
  func1
  
  func2
  func2
  func2
  func2
  </code></pre>
  
  <p>i am using Python 2.7.12 in Ubuntu 16.04</p>