# Easy Guide

This is a DRAFT document.

This document is provided as a reference to advanced MMA users writing plugins. It does not pretend to be definitive or complete. It is a supplement to the main reference manual.

As mentioned in the MMA Reference Guide, a plugin must have its own directory. The name of this directory must be the same as the name you with to assign to the plugin (without the “@” prefix). So, the plugin @HELLO will have a directory hello.

In this directory you must have the following files:

1. __init__.py — this must be an empty file. Note that the name “init” has two leading and trailing underscores,
2. plugin.py — this contains your plugin code.

In the Reference Manual in the Plugins section, we discuss the fact that characters in filenames are, mostly, not case sensitive. However, we recommend that you use lower case characters for all file and directory names.

When the PLUGIN command finds the file plugin.py it is loaded into the running MMA program. The plugin loader will attempt to register three functions or methods from plugin.py:

1. `run(param-list)` — this is the code executed when your new command is encountered in a MMA script.

2. `trackRun(TrackName, param-list)` — this is the code executed when your new command is encountered as part of a track command.

3. `dataRun(param-list)` — this is code which will be inserted into a data line when called.

4. `printUsage()` — this code is used when you request a usage message from the command line using the “-I” option.