
Importing custom Python code
When you’re writing code in Mage, you can import any other Python files using this format:demo_project and you have the following folder structure:
demo_project/utils/helpers/shared.py file:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
You can import any Python code from any file that is in your Mage project directory.

from [project_name].foo import bar
demo_project and you have the following folder structure:
demo_project/
| pipelines/
| utils/
| | helpers/
| | | shared.py
| | | __init__.py
| | __init__.py
demo_project/utils/helpers/shared.py file:
from demo_project.utils.helpers import shared
Was this page helpful?