list=[ 'attribute1', 'attribute2', 'attribute3']
for x in list:
foo = bar.x ()
Error:
AttributeError: module 'bar' has no attribute 'x'
bar has all attributes but I don't know how to pass the variable as an attribute, there should be a way to do bar.attribute1 bar.attribute2 bar.attribute3 without literally specifying it
the solution:
list=[ 'attribute1', 'attribute2', 'attribute3']
for x in list:
foo = bar
foo = getattr(foo, x) ()