I know I can get a Class's attributes with a string like this:
object.attribute = 'foo'
x = 'attribute'
getattr(object, x)
>>> 'foo'
Is there a way to "go deeper" into the object's attributes with a string? In other words, if my object contains another object, how can I get the the sub-object's attributes with a string? For example:
object.object.attribute