Script Includes


In this tutorial you will learn

  • to create a script that can be included into another script
  • include the craeted script in another script

The include statement

Scripts can be included into other scripts with the include statement. The to be included scripts files must be located in one of the following directories so FlowModeler can find them.

  • In the global scripts/ directory under the FlowModeler-Installation-Directory (On Linux: /usr/share/flowmodeler/scripts/)
  • In the scripts/ directory under the User-Data-Directory (On Linux: /home/user/.flowmodeler/scripts/).
  • In one of the paths defined as Script-Search-Path in the Preferences

In case you want to set up a new directory: create the directory in a convenient location on your machine and add the path under Script/Preprocessor/Search-Paths. Multiple paths can be specified when they are separated with asemicolon (:). In the following we assume that a directory named includes has been created in one of the search-paths above.

Create the to be included script file

The file that will be included must be placed in the includes directory. We call it constants.flowScript and put the following content into it:

MY_CONSTANT_1 = 12345
MY_CONSTANT_2 = "abc"

Save and close the file.

Create the user script file

Now create a new script file. The file can now be saved anywhere on the machine (for example the Desktop). We call it here user.flowScript. Add the following to this script:

include includes/constants.flowScript

print( "MY_CONSTANT_1: " + MY_CONSTANT_1 )
print( "MY_CONSTANT_2: " + MY_CONSTANT_2 )

In the above code the include statement is replaced with the content of the includes/constant.flowScript file. Therefore the constant defined in the other file are available in the user script.


The includes statement comes in handy when for example some configuration values must be shared between multiple scripts. The files to be included must be placed in one of the search paths of so FlowModeler can find them.