How to activate/deactivate Kinematic2D "actors" via UI?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By toec

I have two Kinematic2D bodies in the same scene. Each has a different function, and different assigned keys, but when input is given, I don’t want both characters active.
Simple example: Actor A can only jump up and down, Actor B can only move left and right, but I do not want Actor B to be able to move while Actor A is jumping.

I’m assuming this is possible, but I’m wondering where to start.

Do I connect a button/switch to a global variable that is then checked by the script of each actor in their _physics_process() in order for the actors script to determine that movement is allowed? Or is there a built in means of doing such things?