I am running a function within another function. However, the more nested function is unable to access the variables in the main, more global function. When I attempt to run my code I get "x is not defined" error. I would think that since x is a more global variable higher in scope, it should be accessible.
def func_master():
x = 'hello world'
test_sub()
def test_sub():
print(x)
func_master()
I want it to print out 'hello world'.