Run program on boot

What is the recommended method for a program to be executed on boot? I tried saving to main.py, and that gave me an error message.

Correct that main.py is managed by XRPCode. The last program you run in XRPCode is what will run at bootup