Calling Applescripts in other files

I have read the Apple dev docs on the pros and cons of using multiple applescript files and using multiple nib files. I chose to modularize my app and create both multiple script files and nib files. I have an application.applescript and a preferences.applescript. And a MainMenu.nib and Preferences.nib.

The application menu opens the preferences window and runs the needed handlers. But I would like to run some of the preferences.applescript handlers from the application.applescript. Specifically, if I need to pull some preference values, those handlers are all in the preferences.applescript.

So now, my question, how to call the routines in one script file from another script file?

I found this but it appears to be only for AS script groups and not for AS Studio apps.

And on a related note, I’m not sure I understand the difference between the .applescript and .scpt files. References to script files using aliases and such seem to use the .scpt format and do not like the .applescript. But one cannot edit .scpt files within xcode. So which should I be using?

Thanks in advance. mc

Model: Mac Dual G4 1Ghz, 2Gb
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

After doing some more searching, I found this thread that explains it very well.

However, I still don’t understand why this will work on .scpt files and not .applescript files. Can someone shed some light on this?

Model: Mac Dual G4 1Ghz, 2Gb
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

OK, I understand now. I found that the compiled script is .scpt and the uncompiled (or text based) is .applescript. Got it, thanks. Understood.

Side note: You might want to check out Bindings.