Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Client object has no attribute "load_extension"

started a new discordpy program for the first time in a while, and was setting up cogs when this error was thrown:

enter image description here

here’s the bit of code responsible:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

I’m almost positive that I’ve used this code in an older program and yet it refuses to work. the online docs proved unhelpful, so here i am.

I won’t embed it here, but if anyone wants, here’s my full program: https://i.imgur.com/YGOMF3K.png

edit: (ignore line numbers not lining up, I’ve removed some unrelated code in the screenshot)

edit 2: (also I’m 100% sure that wasn’t the code causing the error)

>Solution :

A discord.Client indeed has no attribute load_extension. You might confuse it for commands.Bot, which does have it.

If you define your client as commands.Bot, it should work.

from discord import commands

client = commands.Bot()

https://discordpy.readthedocs.io/en/master/ext/commands/api.html?highlight=load%20extension#discord.ext.commands.Bot.load_extension

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading