Check for running script in lambda

how can i check in a lambda, if a certain script is currently running?

i have defined a template switch, that should report its state based on a running script.
i guess i could rewrite it to get it working using an additional global boolean variable, but since the switch itself acts already as a boolean, i’m curious to get it working directly.