Flask- put routes in separate python file

I’m relatively new to Flask- i’m wanting to place my routes in a separate file.

Lets say my server stuff is located in main.py and I want to put my routes (index, help etc) in a file called routes.py. How would I accomplish this?

You could import the file.

1 Like

Yes… it might work

Any other ideas?

I solved this by looking at flask blueprints, they allow me to load routes from what may be a configuration file.

Thanks for the help!