I have 2 files:
variables.py:
global var
var = 'test'
and main.py:
import variables
class functionsclass:
def __init__(self):
self.testfunction()
def testfunction(self):
print(variables.var)
functionsclass()
that does not work, because 'variables.var' doesn't point to 'test'. What do I have to write to access the variable 'var'? I don't want to use a parameter, I just want to access the global variable.
Edit: Sorry. I'm dumb. In my original file I set the wrong var to global, that's why I could not access it.
Cheers