Let's assume I have the following code:
#!/usr/bin/python3
def genclass():
class stuff:
foo = 'Foo'
bar = 'Bar'
genclass()
How would I access that class outside of the function? I tried the following:
- Just print the function:
print(stuff.foo)
- Print it with the function name:
print(genclass.stuff.foo)
- Same, but with () to indicate that genclass is a function:
print(genclass().stuff.foo)
Unfortunately, none of the above worked.