Discord.py, send a message to a channel I just created

Solution 1:

You're not using the result of the channel creation, instead you're using i which is your index in the iteration. As described in the documentation, create_text_channel returns a TextChannel object, try using that instead:

for i in range (10):
    channel = await guild.create_text_channel('test channel')
    for j in range (5):
        await channel.send("ah")