0

run program other than code.py
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

run program other than code.py

by mallemang on Mon Feb 01, 2021 12:35 pm

How do I run programs that are named other than main.py or code.py in circuit python???

do I always have to copy them to code.py ???
(you wouldn't believe how much time i've spent searching for this answer...LOL).

thanks,

Mark Allemang

mallemang
 
Posts: 1
Joined: Sun Apr 14, 2013 5:08 pm

Re: run program other than code.py

by dastels on Mon Feb 01, 2021 12:45 pm

The runtime looks for "code.txt", "code.py", "main.py", and "main.txt" in that order. It loads and runs the first one it finds.

That's it.

You can, of course, have multiple .py files that you can import in code.py/main.py and call functions, use classes etc that are defined in the imported files.

Dave

dastels
 
Posts: 6491
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.