This question has come up several times in different threads recently, so I thought I'd publish here, along with posts from others, to make it easy for all to find.
Using AppleScript to Restart/Toggle KM Engine
This simple AppleScript will do the job:
tell application "Keyboard Maestro Engine" to reload
Save this in a .scpt file in the macOS Scripts folder.
You can then run using either the macOS Scripts menu, or with FastScripts (recommended).
Using AppleScript to Start/Launch the KM Engine
tell application "Keyboard Maestro Engine" to activate