Run function after t time
<p>I got a problem is: have a variable total time is <code>t_total</code> after a time in <code>t_total</code> i want to run some function and the time continue count up or down to the end of <code>t_total</code>. It look like:
<code>---t1---t2--</code>
when time equal t1 run a function and in t2 run another function.
I tried to make a count function:</p>

<pre><code>for t in range(t_total):
    t = t + 1
    time.sleep(1)
    if t = t1:
        function1()
</code></pre>

<p>but if follow that function the count up will stop at time when run function1. So, have anyway to keep the count continue to run the function2?</p>

<p>You can do using <a href="https://docs.python.org/2/library/threading.html" rel="nofollow">thread</a></p>

<pre><code>import threading
for t in range(t_total):
    t = t + 1
    time.sleep(1)
    if t = t1:
        threading.Thread(target=function1).start()
</code></pre>

python