Q:

Run python module from command line

I don't really know how to ask this question but I can describe what I want to achieve. I would update any edits that would be suggested.
I have a python module that makes use of some command line arguments. Using the module requires some initial setup outside of the python interpreter. The python file that does the setup runs fine, but the problem is that I have to dig through the python installation to find where that file is located i.e. I have to do python full-path-to-setup-script.py -a argA -b argB etc.I would like to call the setup script like this
some-setup-command -a argA -b argB etc.
I want to achieve something like
workon environmnent_name as in the virtualenv module or
pipenv install as in the pipenv module.
I know both of the above commands call a script of some kind (whether bash or python). I've tried digging through the source codes of virtualenv and pipenv without any success.
I would really appreciate if someone could point me to any necessary resource for coding such programs.

A:

If full-path-to-setup-script.py is executable and has a proper shebang line
#! /usr/bin/env python

then you can
ln -s full-path-to-setup-script.py ~/bin/some-command

considering ~/bin exists and is in your PATH,
and you'll be able to invoke
some-command -a argA -b argB

A:

It's a bit difficult to understand what you're looking for, but python -m is my best guess.
For example, to make a new Jupyter kernel, we call
python -m ipykernel arg --option --option

Where arg is the CLI argument and option is a CLI option, and ipykernel is the module receiving the args and options.

