I am creating a chatbot that has 2 main files, main.py
which runs the bot and commands.py
which contains the commands the bot recognizes. I am trying to get the function names from commands.py
in order to use that information (as a simple string/store as a variable) in main.py
. For example:
commands.py
def add():
pass
def delete():
pass
def change():
pass
Basically, I want to be able to store in a variable commands = ['add', 'delete', 'change']
or something similar. I don't have any experience with decorators, but is this possibly a good time to use it? To be able to register commands with a decorator? I'm open to any suggestions, thanks!