assistance-engine/docs/developer.avapframework.com/chapter9_4.md

771 B

4.3. Importing Files

In AVAP, it is possible to import the contents of other code files. The import file.avap statement inserts the contents of the specified file at the exact point where the import statement appears. This process is linear and sequential, meaning that the imported content is executed as if it were part of the original file.

It is crucial that the necessary functions are defined before they are called. If a function is not defined before its call, a NameError exception will be raised.

Example of import usage:

avap

// Content of the file main.avap 
addVar(x, 10) 
include functions.avap 
myFunction(x)

// Content of the file functions.avap
function myFunction(y){
    addVar(result, y + 5)
    addResult(result)
}