# Calling cli with specific python path

**URL:** <https://discourse.slicer.org/t/calling-cli-with-specific-python-path/32278>\
**Category:** Development\
**Tags:** python, python-cli\
**Created:** [October 17, 2023, 4:17pm UTC](https://discourse.slicer.org/t/calling-cli-with-specific-python-path/32278 "2023-10-17T16:17:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gaelle\_Leroux](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/gaelle_leroux/32/66230_2.png) [@Gaelle\_Leroux](https://discourse.slicer.org/u/Gaelle_Leroux)\
**Post date:** [October 17, 2023, 4:17pm UTC](https://discourse.slicer.org/t/calling-cli-with-specific-python-path/32278/1 "2023-10-17T16:17:32Z")

</div>

Hi @lassoan, @jcfr !

We want to run a cli with specific dependencies not compatible with slicerPython, is it possible to specify the python path when we use the slicer.cli.run ?  
Right now it will run with python-real. Or what would be the best way to connect a subprocess run to the cli observer mechanism?

Thank you very much !

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 17, 2023, 4:36pm UTC](https://discourse.slicer.org/t/calling-cli-with-specific-python-path/32278/2 "2023-10-17T16:36:42Z")

</div>

Slicer will always run the Slicer CLI module script in the Slicer Python environment. However, in that Slicer CLI module script you can run any other software (e.g., another Python script, in any environment, using any interpreter, using standard `subprocess` functions). You need to pass all relevant parameters to that other process and wait for the execution to complete before your script returns.

---

<div class="post-metadata">

**Author:** ![Gaelle\_Leroux](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/gaelle_leroux/32/66230_2.png) [@Gaelle\_Leroux](https://discourse.slicer.org/u/Gaelle_Leroux)\
**Post date:** [October 17, 2023, 8:34pm UTC](https://discourse.slicer.org/t/calling-cli-with-specific-python-path/32278/3 "2023-10-17T20:34:24Z")

</div>

I understand, thank you 🙂
