Okay so I read your comment again.
Are you 100% sure that it's the motor inhibitor sensor that's cutting off the power?
Because your symptom sounds like anything.
For example, 1) bad cadence sensor would cause that. 2) bad motor controller, 3) bad connection on motor, controller, etc.