try an execute block, look at my code below.
First i defined the two variables "is_running" and "counter".
In UIFlow i defined pin0 with GPIO26 as input with pull down resistor.!
Then i defined the event_interrupt(pin) - procedure. I use it for counting impulses at the GPIO26, therefore it is necessary to declare the variables as globals.
Every second i read in the main loop the value of the counter variable and reset the is_running variable.
global is_running, counter
is_running = True
counter += 1