Raspberry Pi and ScrollphatHD

Hi there! I’m using a Raspberry Pi 3B+ setup where the ScrollphatHD is connected to. This has been setup by a student who previously worked on this project, and he always manually turned on the LEDs by entering the Python environment in Linux, and then entering the lines:

import scrollphathd as sphd

for y in range(7):
     for x in range(17):
           sphd.set_pixel(x,y,1)
sphd.show()

after which he could do the required stuff. I want to automate this process, so I can call only one bash file and everything happens for me. So, I create a TurnLightsOn.py file as

#!/usr/bin/env python
import scrollphathd as sphd

for y in range(7):
     for x in range(17):
           sphd.set_pixel(x,y,1)
sphd.show()

and converted to an executable by going back to Linux environment and entering
sudo chmod +x TurnLightsOn.py whereafter I can call it using ./TurnLightsOn.py. This then turns on the lights, but immediately switches them off again. How does this happen?

Thanks in advance!

Never mind, I fixed it. It turns out that the init.py file in the library has a function that turns off the LEDs when you exit Python. By using sphd.set_clear_on_exit(False) you prevent this from happening.