Using schedule module to reming me to drink water every ten seconds

I am using schedule module to remind me to drink water every ten seconds

import schedule


def remindDrink():
    print("Drink Water")
while True:
    schedule.every().day.at("16:35").do(remindDrink())

So the problem here is that the task gets executed, but immedieately, not at the given time, and VSCode throws a weird error at me

Traceback (most recent call last):
  File "e:\Code\Python Code\randomModule.py", line 12, in <module>
    schedule.every().day.at("16:31").do(sendNotification())
  File "C:\Users\PC\AppData\Local\Programs\Python\Python310\lib\site-packages\schedule\__init__.py", line 625, in do
    self.job_func = functools.partial(job_func, *args, **kwargs)
TypeError: the first argument must be callable
PS E:\Code\Python Code> 

This is the error, what am I doing wrong?

>Solution :

from schedule import every, repeat, run_pending
import time

@repeat(every().day.at("16:35"))
def remindDrink():
    print("Drink Water")

while True:
    run_pending()
    time.sleep(1)

Leave a Reply