Is it possible to run a script that is not attached to an object?

What I want to do is allow the player to press “esc” to quit the game, but I don’t want to have to put an object dedicated to this in every single level. So, can I have it so that no matter what level I’m in, it will run a script? If there is a simpler solution that would help just as much.

— expat1999