Posted on

Raspberry Pi – Running a Python program after the desktop starts

To automatically run a python program when the LDXE environment loads, you need to add a command to the lxsession autostart file.

Here’s the process:

  1. Open the autostart file: sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
  2. Add this new line: @python yourscript.py
  3. NB: Obviously, you replace yourscript.py with your program!
  4. Save and exit with ctl x then y then Enter.
  5. Next time the Pi boots, yourscript.py will run on the desktop.

 

Mike – G4WNC

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.