Practical Python · Lesson 58 of 76
Python paths
When you split code across files, you bring one file's functions into another with import — using the file name without .py. If helpers.py sits next to main.py:
# main.py
import helpers
print(helpers.clean(" ada "))
Python finds modules by searching a list of folders. You can see what it knows about your setup:
Python
Most beginner imports "just work" when files are in the same folder. If you hit a ModuleNotFoundError, it usually means the file isn't where Python is looking — check you're running from the project folder.
You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →