I assumed your Script Console scope would be gateway, and your button would be designer/client. My assumption was wrong. Just to test, you could try this code in a button as well, and see if the scopes are the same.
I see you have blurred out your filepath. This thread is > 10 years old, but might be relevant.
Option 1:
Option 2: