Skip to main content
To import a shared package from a parent directory in a Metaflow flow, add a symlink in the directory containing your flow script, pointing at the shared package. Metaflow dereferences symlinks when packaging your code (supported since Metaflow 2.5.2), so the package is included whether the flow runs locally or remotely.
flow_type_1
flow1.py
common_utils
flow_type_2
flow2.py
common_utils
common_utils
__init__.py
some_module.py
In the tree above, flow_type_1/common_utils and flow_type_2/common_utils are symlinks pointing to the shared common_utils package.
1

Define the shared package

Define the functionality you want to reuse in a Python package:
common_utils/some_module.py
Export it from the package’s initialization module:
common_utils/__init__.py
2

Create the symlink

Add a symlink from the flow’s directory to the shared package:
3

Import the package in a flow

flow_type_1/flow1.py
4

Run the flow

The run completes successfully, with the shared package included: