I would like to access a variable that is computed in a function but which is not the return value. I am calling this function in another function so I cannot change the return value (I know this is what people usually suggest doing). I have tried using global in front of my variable but when I call it outside, I have the following error: NameError: global name 'DA' is not defined My code looks like this:
def function():
global DA
DA = something
....
return something_different
print DA #(outside the function)
I am relatively new to Python so maybe there is something obvious that I am missing here. Thanks!