2.6. Projects

In the Projects directory, you can store self-contained projects for an easy moving of projects. MeVisLab searches in this directory for projects in a depth of two, so there can be top-level directories containing a number of actual projects directories, and/or just the actual projects directories.

Each projects directory contains a Modules, and optional Sources and TestCases directories (similar to the top-level directory structure of a MeVisLab package). The structure of the Modules directory is similar to a directory of the top-level Modules directory, i.e., it can contain mhelp, networks, and Scripts directories. It also contains the .def, .script, .mlab, and .py files of the module(s) that are defined in a project.

Your project directory can contain the sub-directory Modules/Scripts/python, but to import Python modules from this directory, you have to use a MeVisLab-specific virtual package: If you, e.g., want to import the file Projects/MyProject/Modules/Scripts/python/MyPythonModule.py in your Python code, you have to use the import statement

import mlab_projects.MyProject.MyPythonModule
i.e., you must prefix your import with mlab_projects.<project-directory-name>. For convenience you probably would rather use
import mlab_projects.MyProject.MyPythonModule as MyPythonModule
This also allows to import Python modules/packages from other projects.

[Note]Note

Nowadays the use of the Projects directory is recommended over the old directory structure where the files for a certain module were scattered over the top-level Modules, Sources, and TestCases directories.