Importing Cog object into Discord bot from subdirectory [SOLUTION FOUND] Importing Cog object into Discord bot from subdirectory [SOLUTION FOUND] heroku heroku

Importing Cog object into Discord bot from subdirectory [SOLUTION FOUND]


After trying out various suggestions and attempting to find alternatives, I ended up finding a workaround solution through the usage of loading the Cogs as extensions through the load_extensions() method. Here is where I got the idea to attempt loading extensions to my bot: discord.py rewrite: TypeError: cogs must derive from Cog

In a dispatcher.json file, I create a list of the Python modules containing Cog objects. I pass this list to my init_cogs() function where I then iterate over it to then load each Cog found within a cogs_list parameter.

I hope this solution/workaround helps others in a similar situation that I was.