timer.py (215B) download
1import time, threading
2
3def repeat_timer(sec):
4 def wrapper(func):
5 def thread():
6 while True:
7 time.sleep(sec)
8 func()
9
10 thd = threading.Thread(target=thread)
11 thd.start()
12
13 return func
14 return wrapper