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 via 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
/mnt/<username>/<project name>. 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
First, you need to set up the projects you want to export from. You need to 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. In the panel on that tab, click the checkbox for files or environment variables to make those types of content available to other projects. To export as a package, select the appropriate language from the Code Package dropdown.
Next, open the project into which you want to import content. Click Files from the project menu, then open the Other Projects tab. Add projects by filling in the project name field, then clicking Import. You’ll see projects currently being imported listed in a table below.
Only the files from the directly imported project will be viewable 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 may 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, eg.
import os file_name = os.path.join(os.path.dirname(__file__), 'your_referenced_file.dat')