The most effective way to stop people from using machines while their batteries are charging is to install an interlock system. This safety system consists of two wires connected to the charger and a relay connected to the machine's starting circuit. They are connected in such a way that the circuit is interrupted when the battery is charging, which effectively prevents operators from starting the machine while it’s charging.
Most built-in chargers come with an additional relay to implement an interlock system. Some also have interlock wiring installed by default. Although a universal interlock system does not yet exist, one can always be purchased separately or retrofitted.