i want to run this function in while loop to update the time always (its like an alarm system)
Here is a piece of the code:
def azan(message):
timed1 = ('17:52')
timed2 = ('22:09')
#print(timed2) #for testing
bot.send_message(message.chat.id,"test ☾")
while True:
jt = datetime.now(tz)
time_now = (jt.strftime(dt_format))
#print('azan on') #for testing
if timed1 == time_now:
print ("[☾] It is time for Al Fajr prayer ")
sleep (60)
if timed2 == time_now:
print ("[☾] It is time for Al thar prayer ")
sleep (60)
MainFun_Run = threading.Thread(target=MainFun) #to run the rest of the code
MainFun_Run.start()
azan_run = threading.Thread(target=azan) #to worn me if time has become == [timed1]
azan_run.start()
the problem is when i run it like this i get that error:
TypeError: azan() missing 1 required positional argument: 'message'
and when edit it to be like this: azan_run = threading.Thread(target=azan(message))
i got this error NameError: name 'message' is not defined
.