It seems like there was a bug with this function on 2.0.1 and below, after that it was fixed, and it didn't work properly.
Some time ago, I was trying to do something similar (actually, to make actions rebindable), and the best workaround I found was to delete the whole action, and recreate it.
var event = InputEvent()
event.type = InputEvent.KEY
event.scancode = scancode
for old_event in InputMap.get_action_list(action_name):
if InputMap.get_action_list(action_name).size() > 0:
(Note that if this bug gets fixed, the above code would start working a bit faster)
(Bug fixed by @Hinsbart, YAY)