How to Use Script Modules
To add a script module, simply right click the Script Library [project] package and click the New Script option. Each module is a python script that can define many functions. You can also keep your scripting modules organized in Packages by creating additional nested subpackages. Packages act a little like folders except you can still add scripts to them. To create a Package, click on the Script Library [project] and click the New Package option.
For example, let's suppose you added the following script module named myFuncs
, whose body is shown below.
def callMe(message):
system.gui.messageBox(message)

Now, anywhere in your project you can call this function.
project.myFuncs.callMe('Hello World')
Because each module can hold many functions, you can add any functions you need to this Script Module.

Just like before, you can call this function using:
result = project.myFuncs.addNumbers(14, 87)
Note, that the addNumbers function also has a return value. This will be returned to the script that called the function, allowing you to use it within that script.
System Import
In Ignition, certain libraries are automatically imported into any scripts you create to make everything easier. For example, the System Library is automatically imported, giving you access to all of the "system.
functions" without having to add in "import system"
at the beginning of your script. The Project and Shared Libraries are also imported, giving you access to any of the Script Modules you may have written. However, prior to version 7.7.0, Script Modules did not automatically import the System Library. This means that if using a version older than version 7.7.0, you will need to add "import system
"
at the beginning of your script to be able to use the System Library.