You can configure projects to import files and environment variables from other projects. This allows you to use your team’s existing work as reusable building blocks, and avoid unnecessary repetition.
A canonical dataset used by multiple projects can be managed in a single place.
Your code can reside in a separate project from your data. No need to duplicate large datasets within multiple projects.
An external data source requiring login credentials (such as a database) may be securely represented through environment variables in a single project, and then used by many projects.
Results from one model (such as trained model files, or R workspaces) can be imported and used by multiple different downstream projects.
If a project’s files are organized as an R or Python package, then you can configure other projects to automatically install them at runtime.
The first step is to configure the exporting project. Projects can export files and environment variables.
Other projects can import content from projects that are configured for export. After you’ve set up import, the content from the exporting projects is accessible when you run code in the importing project.
During runs with imported files, each project directory is located at
/mnt<username>/<project name>, where
<username> is the owner of that particular project.
Imported directories are read-only.
The path of your main project will also change from
If you have hardcoded any paths in your projects to
/mnt, we recommend replacing the hardcoded paths to using the
$DOMINO_WORKING_DIR environment variable.
This will ensure the correct path regardless of whether other projects are imported.
See the support article on Domino Environment Variables for more information.
Set up the projects from which you want to export. You must have Owner, Collaborator, or Project Importer access to the projects to set them up for export.
To set up export, open the project in Domino and click Settings from the project menu, then open the Exports tab.
Click the checkbox for files or environment variables to make that content available to other projects.
To export as a package, from Code Package, select the appropriate language.
Open the project into which you want to import content.
From the project menu, click Files, then open the Other Projects tab.
To add projects, complete the Project Name field, then click Import. You’ll see projects currently being imported listed in a table.
Only the files from the directly imported project can be seen when you import. For example if project A is imported into project B, and then your project imports B, only the contents of B will be accessible to your project.
Running python scripts from imported project
When running a Python script from an imported project you might encounter the error message:
FileNotFoundError: [Error 2] No such file or directory:
When a python script runs an import, it executes that code with the current working directory, so if you have a relative path in the imported file, it will try to find the file in the current folder and fail.
In this case, you can update your imported script to use an absolute path based on the current path of the imported file using
os.path, for example.
import os file_name = os.path.join(os.path.dirname(__file__), 'your_referenced_file.dat')