I want to know how can execute a written function automatically after a given time for specified seconds.
for example i want to run function 10 seconds after executing program for 5 seconds.
I want to know how can execute a written function automatically after a given time for specified seconds.
for example i want to run function 10 seconds after executing program for 5 seconds.
In python 2.7 you can use the sleep method. See here: http://docs.python.org/2/library/time.html#time.sleep
You can look at apscheduler. Ir allows you to run scheduled repetitive tasks
You can sleep for 5 seconds, then execute a determined functionB. But you can't assure to run the functionB for a determined number of seconds unless you sleep it too. For example:
import time
def funcA():
secs = 5
time.sleep(secs) # Sleep 5 seconds
funcB()
def funcB():
secs = 10
time.sleep(secs) # Sleep 10 seconds
You can also make this in a thread.