I\'ve got a script that runs on a infinite loop and adds things to a database and does things that I can\'t just stop halfway through so I can\'t just press ctrl+C and stop
To clarify @praba230890's solution: The interrupted variable was not defined in the correct scope. It was defined in the crawl function and the handler could not reach it as a global variable, according to the definition of the handler at the root of the program.