Possibly, custom properties can function much the same, they just don't persist across Gateway Restarts.
The issues with the keyPressed event remind me of similar issues I had with this event handler... Shot in the dark here, but are you pressing the same enter key each time? For example, numpad enter vs. "normal" enter? I had to change:
if event.keyCode == event.VK_ENTER:
...to:
if event.keyCode == 10:
...in order to get my keyPressed events to work properly with any enter key. VK_ENTER
was not working with numpad enter in my scripts. Something small to consider...
The keyCode should be the same for any enter key. If a developer needs a key event to only occur for a specific key where there are more than one of the same type on the keyboard, then event.keyLocation is used to differentiate.
Example:
if event.keyCode == event.VK_ENTER and event.keyLocation == event.KEY_LOCATION_NUMPAD:
print 'This only works for the enter key on the number pad'
if event.keyCode == event.VK_ENTER and event.keyLocation == event.KEY_LOCATION_STANDARD:
print 'This only works for the enter key on the standard keypad'
If event.keyCode == event.VK_ENTER
isn't working universally for enter, I would call that an unexpected behavior that should be reported.