I thought I understood how this would work but apparently I don't. Take this example:
File 1 (sandbox.py):
from module1 import Testy
class Sandy(Testy):
def run(self):
print("This is value of x in Sandy: %d" % x)
super(Sandy, self).mymet()
if __name__ == "__main__":
x = 4
test = Sandy()
test.run()
File 2 (module1.py):
class Testy(object):
def mymet(self):
print("This is the value of x in Testy %d: " % x)
This is what I receive back in the console when running sandbox.py:
This is value of x in Sandy: 4
NameError: global name 'x' is not defined
Is the best/only way of doing this to pass the x argument explicitly to mymet() in the parent class?