I am trying to create a discord bot, but I am caught in an unending loop of problems. In every video I've watched, it is recommended that you write the cog loading function as thus:

```
async def load_auto(): 
    for filename in os.listdir('./cogs'): 
        if filename.endswith('.py'): 
            await bot.load_extension(f'cogs.{filename[:-3]}')

```

but every time I use this form of cog loading it gives me this error:

```
C:\Users\galan\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py:618: RuntimeWarning: coroutine 'setup' was never awaited setup(self) 
RuntimeWarning: Enable tracemalloc to get the object allocation traceback 

Traceback (most recent call last): File "c:/Users/galan/Desktop/new sambot/main.py", line 118, in <module> asyncio.get_event_loop().run_until_complete(main())

File "C:\Users\galan\AppData\Local\Programs\Python\Python38-32\lib\asyncio\base_events.py", line 616, in run_until_completereturn future.result() 

File "c:/Users/galan/Desktop/new sambot/main.py", line 115, in main await load_auto() File "c:/Users/galan/Desktop/new sambot/main.py", line 16, in load_auto await bot.load_extension(f'cogs.{filename[:-3]}') 

TypeError: object NoneType can't be used in 'await' expression

```

I've tried not *await*ing the bot.load\_extension which resulted in it giving a

```
C:\Users\galan\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py:618: RuntimeWarning: coroutine 'setup' was never awaited
  setup(self)

```

while this may look better, it still does not load the cogs. and it doesn't follow others' code where it seemed like it was working.

Here is a part of my main.py file:

```
from discord.ext import commands
import discord
import os
import asyncio

intents = discord.Intents.all()
intents.members= True
sambot_var = ('sambot', 'sambot!', 'sambot?')
bot = commands.Bot(command_prefix='$', intents=intents)

async def load_auto():
    for filename in os.listdir('./cogs'):
        if filename.endswith('.py'):
            bot.load_extension(f'cogs.{filename[:-3]}')

async def main(): 
    await load_auto() 
    await bot.start('token')

asyncio.get_event_loop().run_until_complete(main())

asyncio.run(main())

```

and one of my cogs:

```
from discord.ext 
import commands 
import sys 
import discord 
import random 
sys.path.append("..") 
import datetime 
import pytz 
import re 
import asyncio

class Personality(commands.Cog): 
    def init(self, client): self.client = client

...

async def setup(bot): await bot.add_cog(Personality(bot))

```

My questions are:

1. Does await bot.load\_extension(cogs) actually not need to be awaited?
2. Where did I go wrong?
3. What is the solution?

EDIT: The problem was that I had the old discord package ffs. My code worked fine, it just didn't work fine on my device. The problem of `await bot.load_extension(cog)` was caused by my outdated package.

It's always the most simplest answer. Either way, thank you for answering my questions.