Documentation

Using Modules

Abstract

SummaryHow to create and use code modules when working with the Code Engine.

As your code grows, it becomes increasingly meaningful to break up your code into modules. Code sub-modules can be used to encapsulate and import logic, just as a Python module would be used. It can also be used as a means to store configuration, allowing the user to easily update this configuration via code. You can do this in the UI or programmatically by utilizing Alooma's Python library. Note that sub-modules should not exceed 10,000 lines of code.

Using the UI to work with code modules

You can manage your code via separate "modules", or tabs right in the Code Engine. You can open existing modules, create new ones, edit, and delete. Any changes you make and then test on a sample event will all be run as part of the test. Once you're done, just deploy and everything will be handled on the backend.

To create a new module, click the Plus button (+). Give the module a name. The original, first module is named main. Remember to import the other modules you wish to use into main.

To open an existing module, click the icon with three horizontal lines, to the left of the main tab.