Script libraries can be used by storing scripts in the folder ‘~/Libsrary/Script Libraries’ and include them in your script by the use statement. This will make one instance of the script like a true library.
When you store a script file named StringHandlers.scptd for in ‘~/Library/Script Libraries’ you can use it as follow:
use StrLib : script "StringHandlers"
-- to call its handler
When the script has it’s own terminology rather that user defined (sdef defined) and you insert it’s terminology in the global namespace, you should consider wrapping the user terms from block around the call to avoid conflicts with other things.
When you want to instantiate your script file multiple times you can use load script. Another feature is that the library can be stored anywhere you want.
-- load an instance of the object and store it in a variable
set StrLib to load script (path to desktop folder as string) & "StringHandles.scpt"
-- call the handler from the instance
NOTE: You can wrap a big handler around script objects using script libraries. This enables you to let the handler behave like you have loaded the script using load script.