if another script is running

Hey i need a if function that start when another script is akive

if(another script is running) {

things happen

}

can anyone say me what i have to write thx for answers

ps sorry for mistakes im german

one way to do that is using a bool variable, for example set a variable name isRunning.
in script A, if something is happen set isRunning=TRUE.
then check the state of isRunning in script B and make him to do what he need to do if isRunning=TRUE. just an example…