Include other AS files?

hi,
I am making a as framework kinda thing that includes all the code i use in almost every application.
I know there is a way to do this in Cocoa but how can i “include” other files?

example:


-- Main AS File.applescript
on will finish launching theObject
	import "some other file.applescript"
	function()
end will finish launching


-- some other file.applescript
on function()
--do something
end function

I get a build error not understanding the “inport” part.

If anyone knows how to do this i am very thankful

It’s not quite the same, but you can use load script (see Standard Additions).

set something to load script whatever
tell something to doSomething()
on will finish launching theObject
	set API to load script (path to me as string) & "Contents:Resources:Scripts" & "NSAPI.applescript"
	tell API to NSAPI()
end will finish launching

i get the error “Can’t make … into type file”
(have tried without the path to app, have tried with a “.scpt” file)

Try something like this:

set API to load script (path to resource "NSAPI.scpt" in directory "Scripts")

thanks, the first script is working now. (not sure why :stuck_out_tongue: )