I have two classes, classA and classB. classA has an attribute named image that contains data that is changing all the time. I want to be able to have an instance of classB that when I call a method on this instance, it can access self.image from classA. Unfortunately my attempts are failing.
Example code:
classA:
    def __init__(self):
        self.image = None #initialise
        analysis = classB(self)
    def doingstuff(self):
        self.image = somethingchanginghere()
        measurement = analysis.find_something_cool()
        print measurement
classB:
   def __init__(self, master):
       self.image = master.image #get a reference to the data from other class
   def do_something_cool(self):
       return type(self.image) #find something about the data at the point when method is called
main = classA()
main.doingstuff()
I get an error that says the data is still None, i.e. it's still in the state when it was initialised and the reference to classA from classB hasn't updated when self.image in classA changed. What have I done wrong?
Why does the working example give NoneType? I'm expecting a random number.
 
     
    