Tuesday, 13 August 2013

Script calling multiple other scripts erroring due to undefined functions

Script calling multiple other scripts erroring due to undefined functions

I'm unsure again with something what I'm sure is going to be very simple...
Basically, I'm trying to make my first script call/execute a bunch of
other scripts but the problem is I want each individual script to contain
its own functions not be called from the first secript...
First script/main script:
errors = open('ERROR(S).txt', 'a')
try:
execfile("secondary.py")
except Exception as e:
errors.write(str(e))
errors.close()
Below is secondary.py
def hi():
print "hi"
hi()
Error:
global name 'hi' is not defined
How would I go about fixing this?
Thanks in advance Hyflex

No comments:

Post a Comment