how to schedule the greeting message with python
import datetime
import pyttsx3
morning_greet = False
after_noon_greet = False
night_greet = False
while True:
if morning_greet == False and datetime.datetime.now().hour > 4 and datetime.datetime.now().hour < 7:
pyttsx3.speak("Good morning Vishnu")
morning_greet = True
if after_noon_greet == False and datetime.datetime.now().hour == 12:
pyttsx3.speak("Good afternoon vishnu")
after_noon_greet = True
if evening_greet == False and datetime.datetime.now().hour > 4 and after_noon_greet == True:
pyttsx3.speak("Good evening Vishnu")
evening_greet = True
if night_greet == False and datetime.datetime.now().hour > 8 and evening_greet == True:
pyttsx3.speak("Good night vishnu")
morning_greet = False
after_noon_greet = False
night_greet = False