How to fix AttributeError: 'list' object has no attribute 'method' in Python | DevErrors