How do I call a discord.py function multiple times for each item in a list?

Im using discord API in python to manage a Discord bot. This command creates a list of people in a certain discord channel.

I have a function:

async def attendance(ctx, channel):
    # code here that creates a variable with member names
    await bot.say(printdiscordnames)

I want to call the above function each time with a different channel name in a list

So I would do:

async def attendanceall(ctx):
    channel_list = ['voice1', 'voice2', 'voice3']
    for item in channel_list:
        attendance(item)

Basically I want to do !attendanceall in discord and it will do the first function which makes a list and prints it in discord for each channel in the list.

My issue is I dont know how to call the first function for each channel name in the list.


async def attendanceall(ctx):
channel_list = ['voice1', 'voice2', 'voice3']
for item in channel_list:
    asyncio.get_event_loop().create_task(attendance(item))

you can do this to run an asynchronous function or use the one below as another way of running it

async def attendanceall(ctx):
channel_list = ['voice1', 'voice2', 'voice3']
for item in channel_list:
    client.loop.create_task(attendance(item))

try:

async def attendanceall(ctx):
    channel_list = ['voice1', 'voice2', 'voice3']
    for item in channel_list:
        await attendance(item)

refer this link for help