Good, lazy programmers and computer users like to keep functions they've already written in some kind of library and call upon them when needed, instead of copying. You can do that with your AppleScripts too.
This project consists of three short AppleScripts, demonstrating
(a) the first script calling the second script, passing variables as parameters
(b) the first script calling a handler in the third script, passing variables as arguments to the handler.
Visit this project's GitHub Repository to download, fetch, or clone this code.
After you've doubleclicked on the first script to run the demo, open the three scripts in Script Editor to learn how they work.