Assuming you are on Windows, you should use injected keystrokes, otherwise the keystrokes go to the currently in-focus application.
With injected keystrokes (if the application supports them), you can click on the target application when programming them and they will use that application to send the keystroke to.
I use injected keystrokes on my Windows platform with OBS all of the time.
Alas on Mac, there are no injected keystrokes so you would have to use AppleScript (or something similar) to focus the proper application prior to sending the keystroke.
Steve Caldwell
Bome Customer Care
Also available for paid consulting services: bome@sniz.biz