I am trying to figure out how to access a class instance in another class in Python.
In the example below I create two classes, house
and paint
, and I want to use the dimensions from the house
class as a variable in the paint
class:
class house:
def __init__(self, length, width)
self.length = length
self.width = width
class paint:
def __init__(self, color_paint, price):
self.color_paint = color_paint
self.price = price * (length * width) # <-- length and width from class house