Python: access class property from string [duplicate]

x = getattr(self, source) will work just perfectly if source names ANY attribute of self, including the other_data in your example.

Leave a Comment