According to this answer you can import pip from within a Python script and use it to install a module. Is it possible to do this with conda install?
conda install
The co
You can use conda.cli.main. For example, this installs numpy:
conda.cli.main
numpy
import conda.cli conda.cli.main('conda', 'install', '-y', 'numpy')
Use the -y argument to avoid interactive questions:
-y
-y, --yes Do not ask for confirmation.