> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Access parent directories from a flow

To import a shared package from a parent directory in a Metaflow flow, add a [symlink](https://en.wikipedia.org/wiki/Symbolic_link) 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:

```py title="common_utils/some_module.py" theme={null}
import os

def general_function():
    return os.getcwd()
```

Export it from the package's initialization module:

```py title="common_utils/__init__.py" theme={null}
from .some_module import general_function
```

**2. Create the symlink**

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

```sh theme={null}
ln -s ../common_utils flow_type_1/common_utils
```

**3. Import the package in a flow**

```py title="flow_type_1/flow1.py" expandable theme={null}
from metaflow import FlowSpec, step

class Flow1(FlowSpec):

    @step
    def start(self):
        from common_utils import general_function
        self.result = general_function()
        self.next(self.end)

    @step
    def end(self):
        pass

if __name__ == "__main__":
    Flow1()
```

**4. Run the flow**

```sh theme={null}
python flow_type_1/flow1.py run
```

The run completes successfully, with the shared package included:

```text theme={null}
Workflow starting (run-id 1666836481231665):
[1666836481231665/start/1 (pid 81716)] Task is starting.
[1666836481231665/start/1 (pid 81716)] Task finished successfully.
[1666836481231665/end/2 (pid 81719)] Task is starting.
[1666836481231665/end/2 (pid 81719)] Task finished successfully.
Done!
```
