from threading import Timer import time, datetime mm = 18 t = datetime.datetime.today() future = datetime.datetime(t.year,t.month,t.day,23,mm) diff = future - t delta = diff.total_seconds() print("waiting until 11:%i PM, which is %i seconds from now." % (mm,delta)) def func(a, b): print("Called function") return a * b # Schedule a timer for 5 seconds # We pass arguments 3 and 4 t = Timer(delta, func, [3, 4]) start_time = time.time() # Start the timer t.start() end_time = time.time() if end_time - start_time < 5.0: print("Timer will wait for sometime before calling the function") else: print("%i seconds already passed. Timer finished calling func()" % mm)