Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Using include files in interview script files
 
Using include files in interview script files
If you want to use the same functions or standard sections in multiple projects, you can specify them in a different file, and then include that file in the routing section of interview scripts by using the #include statement.
When you save the interview script file (.mdd), the included scripts are pulled into the routing section. Therefore the included scripts must be available when the interview script is saved by Professional, Author, or Author Server.
Author users can also use the #include statement in a script item. For more information, see Adding scripts.
Syntax
#include "filename"
Searches for the file first relative to the interview script, and then in the Helper scripts file location.
#include <filename>
Searches for the file in only the helper scripts file location. Enclose the filename in < > (angle brackets)
Parameter
filename
The name and location of the file to include. Typically, this is a text file with a filename extension of .mrs.
The path must be relative to the folder that the interview script is in, or relative to the helper scripts file location.
Notes
Put #include statements an appropriate position. For example, if the included file contains a function, put the #include statement before, after, or between the functions in the file.
Included files can contain #include statements, but be careful not to create a circular construction.
Do not use line-continuation characters in an #include statement.
mrScriptBasic and mrScriptMetadata error messages give the approximate line number where the error occurred. Using an Include file might result in misleading line numbers in these error messages because the line numbers are calculated by using the expanded file.
You can use files with any extension (for example, .txt). However, to ensure that your interview script file can be debugged, include only .dms or .mrs files.
Example of using #include statements
The following interview script file is an example of a framework that might be given to script writers for starting new projects.
The settings and initialization scripts are included at the start of the file because they must run before the script. The include file containing functions is at the end of the script, because the functions are standalone: this position means that when you look at the script, you do need to scroll past the functions to see it.
Routing(Web)

#include <includes\v22\settings.mrs>
#include <includes\v22\initialization.mrs>

' Put script here

#include <includes\v22\functions.mrs>

End Routing