i was looking for a way to make the cog executes a function withing the cog when it's loaded/reloaded but i found no such function or anyone talking about it,
so i came up with the INGENIOUS idea of trying to use a string to call a function within the cog.
i tried couple of things, mainly a combination of eval and getattr but i was unsuccessful to get a working code coz... brain too smol.
hope this will clear the idea of what i want to do:
cog test.py
class test(commands.Cog):
@commands.command()
async def testReload(self, ctx):
# do stuff
and this is the reload function in main.py
import cogs
@bot.command()
async def reload(ctx, extension):
bot.reload_extension(f'cogs.{extension}')
await ctx.send(f'reloaded {extension}')
# cogs.(extension).(extension)Reload # something like this