A class outlines attributes that are later defined by class instances. For example, a Rectangle class accesses its attributes height and width to calculate its area().
Solution for How to access instance data within a class in Python : You can use self to access instance data within a class Add self as the first parameter of a class method to make it an instance method. Use self to access instance attributes.