I'm fairly new to both Python and Google App Engine. I want to organize my script files by creating a folder structure. However when I do that I can no longer figure out how to import them.
For example:
main.py
/eggs/spam.py
How do I import spam.py in main.py?
Make eggs a package by adding an __init__.py
file in the folder. It can be empty, as long as it's there. Then, import spam like this:
import eggs.spam
More information on packages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With