I am trying to develop this program , that invokes the main function of another program and takes the program to be inkoved's name as user input , let us call this program 1 :
Program 1 # takes the program 2's name as user input
try:
print "Please input the file you want to test"
filename = raw_input().split(".")[0]
module = __import__(filename)
except:
program 2 is like
def main():
first()
def first():
5/0
if __name__ == "__main__":
main()
so basically I want to know how to invoke program 2's main function from program 1 .
thank you
importing the other file.importstatement. In either case, you can treat it like a regular module; I don't see where the issue lies.