I am creating a CLI choose your own adventure game for a school assignment in Python 3.8.3. I have the code structured like this:
While True:
if room=='a room':
(code for the room, ending with a change of rooms)
elif room=='another room':
(code for the room, ending with a change of rooms)
etc.
I want to be able to restart my program at any point using ctrl+r
I have tried using Pygame's event list, but this doesn't work for me, as I cannot check this while the other stuff in the program is running. I guess I need something in python that can run at the same time as the main program, continually checking for an input of CTRL+R
I've heard that there is an async keyword that could maybe do this, but I'm not sure how.