import otherFile #non-async functions in there
class A():
def __init__():
#do stuff
self.loop = asyncio.ensure_future(self.function())
#other async functions
async def function():
while(True):
for a in b:
for x in y:
result = otherFile.function()###does some requests
##do other stuff
await asyncio.sleep(1*60)
Hey ~ the code from above is a pseudo version of a python program im working/learning on.
As you can see there is a asyncio loop, which iterates over 2(nested) for loops and then does some function calls to a function which is not async, every 60 seconds.
Problem is that if the lists b and y gets larger finishing the loop takes quite the amount of time because of the function call, which does some reuqests and other stuff in it.
My question now is, is there a way so i could do the function call inside the for loops simultaneously to safe some time?
To give some information about the for loops, the size of these lists is not fixed but rather dynamic and depends on some other files