I am writing a program with an infinite while loop that runs a function which takes input from the user and then prints to the console. I would like to be able to do something along the lines of having a separate piece of code that continually checks the time as a background process and at a certain time, prints a message to the console and asks whether you'd like to quit the program or continue the while loop. I assume I'd need multithreading or something along the lines of that.
def main():
while True:
x = input("Write Something: ")
print(x)
main()