I have no intention of trying to reinvent a perfectly good wheel.
Also, I haven’t yet learned to code in Python — and I don’t class myself as much of a coder anyway!
This is the code with excellent tutorial that I plan to put into my Raspberry Pi:
How to use interrupts with Python on the Raspberry Pi and RPi.GPIO