Important note: all examples follow aTbRef naming conventions.
Calling functions from action code
Regardless of where stored, every function in the current document can be called from any action.
If a function has arguments, the caller must supply values for each argument, even if only as an empty string (or other default data-type value. Extra arguments are ignored. If a function is redefined, the most recent definition replaces any existing definitions.
Examples
Calling a single literal value for an argument:
$MyNumber = fAddTax(500);
Calling a function with a single argument:
$Text = fMakeTable($CategoryList);
Calling a function with multiple arguments, that returns List-type data (see here for multi-value returns):
$MyList = fAlterList($CategoryList,$SomeString,"alternate");
A function with no arguments:
fReset();
Note in this case that whilst no left-side recipient is needed but function parentheses must be included.
Can a function call another function?
Yes. A function can call itself. This is called 'self-reference', and is an advanced technique that should be used with caution and tested in a test document before use at scale. This process is also known as recursion.
Next: Variable use in functions