chat = await Chat.objects.aget(chatid = chatid)if hasattr(chat, 'agent') and 'active' in chat.status: await asyncio.sleep(5)This code throws KeyError: 'agent'.
In Python 3 hasattr uses try-except underneath so it shoudn't be a problem if attribute doesn't exist. So what could be possible reasons?