How to fix RuntimeError: generator already executing in Python | DevErrors