In your hotkeynet settings the Disable foreground lock is checked?

Options > Settings > Disable foreground lock

With this option checked and the code that i posted earlier I don't face any errors

Give it a try, good luck