You can use on_input only to save that input is active. Then on_update to process it. This way you only get 1 input per frame instead of the multiple you sometimes can see. Then at end of on_update disable all of these bools.
function update(self, dt)
if self.rightclick_pressed then
print("rightclick_pressed")
end
self.rightclick_pressed = false
end
function on_input(self, action_id, action)
if action_id == hash("rightclick") and action.pressed then
self.rightclick_pressed = true
end
end