# How to make a python auto start when the Raspberry Pi boot up

**URL:** <https://forum.core-electronics.com.au/t/how-to-make-a-python-auto-start-when-the-raspberry-pi-boot-up/18737>\
**Category:** Uncategorized\
**Created:** [9 December 2023 05:36 UTC](https://forum.core-electronics.com.au/t/how-to-make-a-python-auto-start-when-the-raspberry-pi-boot-up/18737 "2023-12-09T05:36:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Willie252209](https://avatars.discourse-cdn.com/v4/letter/w/848f3c/32.png) [@Willie252209](https://forum.core-electronics.com.au/u/Willie252209)\
**Post date:** [9 December 2023 05:36 UTC](https://forum.core-electronics.com.au/t/how-to-make-a-python-auto-start-when-the-raspberry-pi-boot-up/18737/1 "2023-12-09T05:36:50Z")

</div>

I write a python under Thonny and it can run inside Thonny  
Now, I want to run this python automatically when the Raspberry Pi boot up  
May I know how to do this?

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [9 December 2023 05:44 UTC](https://forum.core-electronics.com.au/t/how-to-make-a-python-auto-start-when-the-raspberry-pi-boot-up/18737/2 "2023-12-09T05:44:31Z")

</div>

Hi Willie!

Good to have you with us.

Are you comfortable with the linux terminal?  
If so, I use one approach in my Parisians Project that might work for you.

> [@Project by Pixmusix; Simulated Parisians: Little Autonomous Pedestrians](https://forum.core-electronics.com.au/t/project-by-pixmusix-simulated-parisians-little-autonomous-pedestrians/17042):
>
> I have just shared a new project: [“Simulated Parisians: Little Autonomous Pedestrians”](http://core-electronics.com.au/projects/simulated-parisians-little-autonomous-pedestrians) [image] IntroductionParisians is a cute simulation of Paris with autonomous pedestrians. It’s simple to build and easy to personalize, a Single Board Computer “wall piece”: on display and looping forever. Citizens walk around the stylised streets of … [Read more](http://core-electronics.com.au/projects/simulated-parisians-little-autonomous-pedestrians)

# 

-------- FROM THE [PROJECT PAGE](https://core-electronics.com.au/projects/simulated-parisians-little-autonomous-pedestrians/)-----------

### Launching Simulation on Reboot.

We want this simulation to automatically launch when we power on the PI. There are lots of ways to do this, but I had the most success placing the following code in my .bashrc file.

```bash
sleep 5 
cd /absolute/path/to/yourproject 
python3 main.py 

```

Then I ensured the terminal booted on launch.

```bash
cd home/pi/.config/lxsession/LXDE-pi/ 
echo "@lxterminal" >> autostart 
reboot 

```

Having the terminal open appeared to be “necessary” to make the hotkeys trigger. I also found that this method ensured that wifi and other auxiliaries would be operational before the loop would run.

* * *

If you need more clarification don’t hesitate to ask 🙂  
Pix ❣
