Libraries are collections of handlers, also called “user commands”, which you keep in separate scripts.
You can load them when needed and use the functions contained within such library. If we have this library, containing 1 handler, in a script called “whatever.scpt”:
on userName() text returned of (display dialog "What is your name?" default answer "") end userName
We can use the userName handler from our main script as follow:
set myLibrary to (load script alias "path:to:whatever.scpt") tell myLibrary to userName()
You can also load libraries “statically” by declaring the library as a property:
property myLibrary : load script alias "path:to:whatever.scpt"