# invoking python CLI module from command line

**URL:** https://discourse.slicer.org/t/invoking-python-cli-module-from-command-line/3369
**Category:** Support
**Created:** [July 3, 2018, 7:03pm UTC](https://discourse.slicer.org/t/invoking-python-cli-module-from-command-line/3369 "2018-07-03T19:03:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tjbertram](https://avatars.discourse-cdn.com/v4/letter/t/f04885/32.png) [@tjbertram](https://discourse.slicer.org/u/tjbertram)
#### Post date: [July 3, 2018, 7:03pm UTC](https://discourse.slicer.org/t/invoking-python-cli-module-from-command-line/3369/1 "2018-07-03T19:03:06Z")

</div>

Operating system: macOS 10.13.2 (High Sierra)  
Slicer version: 4.8.1  
Expected behavior: able to invoke python CLI module from command line  
Actual behavior: not able to invoke python CLI module from command line

Greetings - I am trying to create a python CLI module, following the specification given in  
[https://www.slicer.org/wiki/Documentation/Nightly/Developers/SlicerExecutionModel/Python](https://www.slicer.org/wiki/Documentation/Nightly/Developers/SlicerExecutionModel/Python)

I have created the file myPythonCLImodule.py, which includes the XML and Execute() method as specified at the URL above. I have also created the directory and added the path to the settings as specified in the instruction (also in the URL above):  
“To create a working Python CLI module, just create a directory, put your .py file there and add the directory path to the path list in Application settings - Module settings.”

I then try to invoke this python CLI module from the command line, as follows  
./Slicer myPythonCLImodule  
but nothing happens.

My question is: How do I invoke a python CLI module from the command line?

I assume that one does not need to rebuild Slicer, or run Slicer from the slicer/superbuild directory, in order to run a python CLI module - is this correct?

I should also point out, just for reference, that the following command line is working just fine for me:  
./Slicer --no-main-window --python-script /tmp/test.py  
This is not my problem. My problem is how to invoke my own python CLI module from the command line.

Thanks in advance for any assistance you can provide.

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [July 3, 2018, 10:30pm UTC](https://discourse.slicer.org/t/invoking-python-cli-module-from-command-line/3369/2 "2018-07-03T22:30:03Z")

</div>

Hi -

Thanks for pointing that out - the documentation on that wiki page was vague. It says Slicer3 but didn’t indicate that things are different in Slicer 4. I added a big warning at the top with a pointer to this example with a python CLI that works with the current Slicer 4.9 (Nightly Preview) version:

> **[SlicerRadiomics/SlicerRadiomicsCLI at master · AIM-Harvard/SlicerRadiomics](https://github.com/AIM-Harvard/SlicerRadiomics/tree/master/SlicerRadiomicsCLI)**
>
> master/SlicerRadiomicsCLI
