I m gonna try to explain to you how my script is working and enabled...assuming you already installed RPI tools addon...try to follow this...
Make a folder in Storage/.kodi/userdata/and name it "fan" and place your cooler.py in there.Anywhere in /storage should work but I m using this location as an example and that is where I keep my scripts..
Copy this and save it as "cooler.service"
[Unit]
Description=PWM Fan Control
[Service]
Type=simple
ExecStart=/usr/bin/python /storage/.kodi/userdata/fan/cooler.py
Restart=always
RestartSec=20
[Install]
WantedBy=kodi.target
Display More
Then place the "cooler.service" in Storage\.config\system.d
After you place your file in system.d go to ssh to your Rpi
Enable it with
and then start it with
Check if its working
systemctl status cooler.service
Hope I helped you in some way.