title: How to make a function return after 5 seconds passed in Python?
body: <p>I want to write a function which will return after 5 seconds no matter what:</p>
  
  <pre><code>def myfunction():
      while passed_time &lt; 5_seconds:
          do1()
          do2()
          do3()
          .
          .
      return
  </code></pre>
  
  <p>I mean, this function run for 5 seconds only, after 5 seconds, it should end, and continue with other function:</p>
  
  <pre><code>myfunction()
  otherfunction()   ----&gt; This should start 5 seconds after myfunction() is executed.
  </code></pre>
  
  <p>Best Regards</p>