I created a python module I install. It uses a Bash CLI commands such as my-module init or my-module delete. The structure is like: my-module/ |--- setup.py |--- my_module | |--- __main__.py | |--- delete.py | |--- init.py setup.py setuptools.setup( name="my-module", entry_points={ "console_scripts": [ "my-module = my_module.__main__:cli" ] }, __main__.py @click.group(chain=True) def cli(): pass cli.add_command(init_cmd) cli.add_command(delete_cmd) init.py @click.command("init") @click.option("-p", "--path", type=str, help="Path to the project workspace." ) def init_project_cmd(path): pass It works correcly, however, the autocompletion does not work. It does work for my-module but not for the second part. Following this I edited .bashrc adding the line: eval "$(_ML_PIPELINE_COMPLETE=bash_source /path/to/my-module/my_module/__main__.py)" However, (after running chmod to __main__.py because I had a permission error) I have the error messages saying import-im6.q16: unable to open X server `' @ error/import.c/ImportImageCommand/359. from: can't read /var/mail/my-module.delete from: can't read /var/mail/my-module.init /path/to/my-module/my_module/__main__.py: line 9: syntax error near unexpected token `(' /path/to/my-module/my_module/__main__.py: line 9: `from some_module import (' My quesitons: Am I on the good track? What am I missing then? The errors looks very weird and it feels like the autocompletion should be easy. If so, now I have to (at least), to add a line to bashrc, with the path to the main file (that I don't really know because each user will have their own path to python packages). How can I automate this so that it is done with the pip install command? Continue reading...