In all programming languages we can import our own packages. What if you want to import your own script in another AppleScript file? Its’ possible.
Script [14.6.1] (Syntax):
set scriptPath to (load script file "file Location")
tell scriptPath
methodName()
end tell
Explanation: First we create a variable pointing to the file location of the AppleScript file that we want to load.
Then we can tell this variable to call the handlers from the AppleScript file we imported.
Script [14.6.2]:
set scriptPath to (load script file "Macintosh HD:Users:nayan:Desktop:AppleScript:14 - handlers.scpt")
tell scriptPath
method2("Hey Brother")
end tell
Figure 14.6.2 Calling Handlers from AppleScript File We Imported