This is my code when I run this I want to exit the indicated time but I exit only EndScript I want a full script exit how I get an exit. please suggest to me thank you.
import threading
import datetime
import sys
from time import sleep
def EndScript():
    while True:
        print("============== EndScript Calling ==================", datetime.datetime.now().hour, datetime.datetime.now().minute)
        if datetime.datetime.now().hour >= 12 and datetime.datetime.now().minute >= 6:
            sys.exit()
        sleep(5)
def StartScript():
    thread1 = threading.Thread(target=EndScript)
    thread1.start()
    while True:
        print("===================== StartScript Calling ====================")
        sleep(2)
    
if(__name__ == '__main__'):
    StartScript()
