Let's think about it this way for a moment
It's inconvenient to have to manually re-run a Python script (LED control, sensor monitoring) every time there's a power failure or restart — register it as a systemd service instead, following the same systemctl enable pattern from the Linux tutorial, and the script will run automatically every time the Pi boots. You create a service file (.service) in /etc/systemd/system/ and configure fields like ExecStart (the command to run), WorkingDirectory, and User.
Let's connect it to a real scenario
Create a my-project.service file, write ExecStart=/usr/bin/python3 /home/pi/my-project/main.py in the [Service] section, and run sudo systemctl enable my-project.service (from the Linux tutorial) to make it auto-start on every boot — you can check whether it's running with sudo systemctl status my-project.service (the same systemctl status pattern from the Linux tutorial).
Let's look at it together
# /etc/systemd/system/my-project.service
[Unit]
Description=My Raspberry Pi Project
After=network.target
[Service]
ExecStart=/usr/bin/python3 /home/pi/my-project/main.py
WorkingDirectory=/home/pi/my-project
User=pi
Restart=always
[Install]
WantedBy=multi-user.target
# Then:
# sudo systemctl enable my-project.service
# sudo systemctl start my-project.serviceRunning sudo systemctl status my-project.service should confirm the service is running with 'active (running)' — and the script should keep auto-running even after restarting the Pi.5-minute try-it
Revisit the systemd lesson from the Linux tutorial and write a service file yourself for your own Python script (if you have one).
A quick word of caution
Using Restart=always while your script still has a bug can trigger a crash-restart loop (it keeps crashing and restarting endlessly) — confirm the script runs stably by hand before registering it as a service.