For both Render Note and more complicated scripts, it's generally useful to split the code into multiple Code notes.

When a script is run, the sub-children of the script being run (or the Render Note) are checked for children. If the children are Code notes of the corresponding type (front-end or backend) as the code being run, they will be evaluated as well.

The collection of a script and its child notes is called a bundle. A child note inside a bundle is called a module.

As a basic example of dependencies, consider the following note structure:

- Script with dependency

      api.log(MyMath.sum(2, 2));

  - MyMath

        module.exports = {
            sum(a, b) {
                return a + b;
            }
        };

When Script with dependency is run, it will detect MyMath as a submodule and provide the result of its `module.exports` object into a global object with the same name as the note.

If the note contains spaces or special characters, they will be stripped. For example `My Nice Note!` becomes `MyNiceNote`.

## Alternative syntax

Instead of providing an object to `module.exports`, it's also possible to add fields individually:

    module.exports.sum = (a, b) => a + b;
    module.exports.subtract = (a, b) => a - b;

## Ignoring a code script from a bundle

To ignore a script from being included in a bundle (e.g. if it's unrelated to the parent script note), apply the `#disableInclusion` label.

## Sharing a module across multiple bundles

Modules can be reused across multiple scripts by simply cloning the shared module between two modules (see Cloning Notes).

Optionally, a separate note can be used to contain all the different reusable modules for an easy way to discover them.