Hi
it seems that your method onKey in control.lua doesn't check if the entity is a switchbutton or something else. (it also doesn't check if the entity is valid) This generates a non-recoverable error when pressing the assigned key while selecting a different entity (or at least an entity without control behaviour).
If it matters, I have "Toggle on/off on click" set to false.
The mod Switch Button by GalactusX31 updated for 1.0 (0.1.19) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event Switch_Button-1_0::switchbutton-keybind (ID 218)
Switch_Button-1_0/control.lua:63: attempt to index local 'control' (a nil value)
stack traceback:
Switch_Button-1_0/control.lua:63: in function <Switch_Button-1_0/control.lua:55>