execfile and function call

Dave Westerman dlwester at comcast.net
Mon Sep 24 15:59:52 EDT 2007


I've got a Jython script where I'm doing an execfile() to pull in a 
small script that contains a function, which I then call.

execfile(app_applscript)
optionList = createOptionList(applOptions)

When I do this at the global level in my main script, it works just 
fine. However, when I move this code into a function in my main script, 
then it fails, telling me it can't find the function createOptionList().

Traceback (innermost last):
File "<string>", line 459, in ?
File "<string>", line 429, in processApplication
NameError: createOptionList

Does anyone have any idea what I'm doing wrong? I noticed that 
createOptionList no longer shows up when I do a dir(). Do I somehow have 
to get that to be a global? How do I do that?



More information about the Python-list mailing list