Automation hat permission error

I’m sure someone has already hit this problem, and maybe they can tell me how to solve it. I have written a little Python script to activate one or two relays, depending on a variable that is passed to it. This bit works fine manually, but when the script is called, I get an [Errno 13] Permission denied .Journalctl tells me this:

Feb 08 08:51:53 SatNOGS satnogs-client[2657]:   File "/home/pi/satnogs-client/satnogsclient/antswitch.py", line 14, in <module>
Feb 08 08:51:53 SatNOGS satnogs-client[2657]:     if automationhat.is_automation_hat():
Feb 08 08:51:53 SatNOGS satnogs-client[2657]:   File "/usr/lib/python3/dist-packages/automationhat/__init__.py", line 303, in is_automation_hat
Feb 08 08:51:53 SatNOGS satnogs-client[2657]:     setup()
Feb 08 08:51:53 SatNOGS satnogs-client[2657]:   File "/usr/lib/python3/dist-packages/automationhat/__init__.py", line 354, in setup
Feb 08 08:51:53 SatNOGS satnogs-client[2657]:     _ads1015 = ads1015(smbus.SMBus(1))
Feb 08 08:51:53 SatNOGS satnogs-client[2657]: PermissionError: [Errno 13] Permission denied

It seems I have to grant permission for something (ads1015?) to access somewhere, but what, and where? Grateful for all considered suggestions!

Are you running your file as sudo?
sudo python /myfile.py

I can call the script manually without using sudo (./antswitch.py 1234567) and it works fine, but I’m calling the script from the satnogsclient as a so-called ‘pre-observation script’. As you can see, it works OK for a while but fails at line 354 within the automationhat package … something to do with ‘ads1015’ that I don’t understand.

The ads1015 is for the ADC, it’s on i2c using 0x48 address. Your issue is above my skill level.