I solved my problem, the error message was missleading
i have build a system were all key short cuts are listed. after the player changes some short cuts he can press save and InputMap should rebuild. but there is one part i could not accomplish yet, the (re)adding of the keys:
#...code to clean up InputMap etc
var event = InputEvent()
event.type = InputEvent.KEY
event.scancode = new_key #error here
InputMap.action_add_event(action, event )
I saw examples were "InputEvent" had the attribute "scancode" but i gues this changed. I did try "InputEventKey()" instead of "InputEvent()" because i found it in the docs and thought it an inherited type that could work (it hat the attribute "scancode" but it says it does not know "InputEventKey" at all.
so how can i add a specific key to an action?