I'm getting an error while trying to access a variable from a function which is included using exec(open().read()).
But here I'm able to access the function printName(). Is there any other way without using subprocess?
I'm using python 3.7
main.py
age = 32
def printName(name):
print(name)
exec(open("action.py").read())
action.py
printName("John")
print(age)
John
NameError: name age is not defined
