Darren Dale wrote: > def myfunction(filename): > execfile(filename) > print testvar >
> What am I doing wrong? I'm not familiar enough with execfile or the interactive interpreter to know what you are doing wrong, but something like: def myfunction(filename): ns=dict() execfile(filename, ns) print ns['testvar'] should at least get you going. There is probably a way to pass the namespace of the function to execfile, but I do not know it. max -- http://mail.python.org/mailman/listinfo/python-list