I am making a discord bot using discord.py API. After doing some coding I've realized that I should keep the code clean and keep the commands and events in separate .py files. How could I do that event or command still listen for a trigger and are in separate files? I've tried doing it with import
but it just imports classes. Example command:
@client.command(pass_context=True)
async def kick(ctx, *, member: discord.Member = None):
if ctx.message.channel.permissions_for(ctx.message.author).administrator is True:
await client.send_message(member, settings.kick_direct)
await client.kick(member)
await client.say(settings.kick_message + member.mention + settings.kick_message2)
else:
await client.say(settings.permission_error)