I am just getting started with the library Typer for building CLI's. There are too many commands in my cli.py and I moved them to a separate folder “commands”, but I cannot figure out how to implement a dynamic loader for these commands in cli.py.
my_app/
__init__.py
commands/
__init__.py
command1.py
command2.py
cli.py
I started by creating a class "Command" for each command from module "commands" with a single function "handle (** options)" that contains the functionality. Ideally, when starting cli.py, I want to check which modules are there and load them dynamically, leaving the cli.py file clean. But I do not understand at all how it is better and more correct to implement it.