I have set up a python script, that uses tkinter to launch a window and display some data.

My goal now is to let the Pi run this script after boot. For this, I tried many ways I found on the internet. I tried rc.local, crontab, lxsession, but nothing did the job.

What I've tried so far in case of lxsession: As I could not find the Lxsession configurator in the toolbar menu, I tried to edit the autostart file in


Intending to start my program I added


at the bottom of the file, but my script still did not run on boot.

Thanks for help VRK

  • /home/pi/desktop usually has a capital D ie /home/pi/Desktop
    – CoderMike
    Commented Dec 21, 2022 at 13:56

2 Answers 2


I suggest you start by getting a simple python program running at boot.

Create the following simple code and save as /home/pi/hello.py

import time
print('Hello World')

Add the following to /etc/xdg/lxsession/LXDE-pi/autostart

@lxterminal -e python3 /home/pi/hello.py

This will start the python program in a terminal window so that you can see any output.

enter image description here


I got this somewhere a long time ago and it works into my product flawlessly:

sudo mkdir /home/pi/.config/autostart

then open nano:

sudo nano /home/pi/.config/autostart/yourname.desktop

finally, the content of the file:

[Desktop Entry]
    Exec=/usr/bin/python3 /home/pi/yourfolder/Program.py

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.