@ckp - You are 100% correct. Well done for identifying the root cause.
I tried using the ahk script tab with an emulated game and the scripts work fine!
With regards to Streets of Rage Remake (Windows Game), I created a standalone exe with the following code (see below). After holding button10 and then pressing button 9 on my gamepad, the processes for streets or rage and AHK are closed. I configured LB to launch the ahk exe before the game. Happy days
Joy9::
If GetKeyState("Joy10")
Process, Close, sorR.exe
Process, Exist, Autohotkey.exe
If ErrorLevel <> 0
Process, Close, Autohotkey.exe
Exitapp
Return