Subj : Re: spidermonkey cross script execute doesn't work To : Mike Moening From : Brendan Eich Date : Wed Mar 16 2005 10:53 am Mike Moening wrote: > I compile two scripts using JS_CompileScript(). > The second script uses a function compiled by the first script. > I call JS_ExecuteScript() on the second script and get the error "function > is not defined". > How can I load multiple scripts into the context and allow one to call > functions defined in a different compiled script? You must call JS_EvaluateScript, or JS_CompileScript + JS_ExecuteScript, in turn, for each script in sequence. Compiling doesn't define function or variable names in the global object you pass when executing. Evaluate == Compile + Execute, btw -- it's just a shorthand API. /be .