# How to import Slicer in python-cli

**URL:** <https://discourse.slicer.org/t/how-to-import-slicer-in-python-cli/8083>\
**Category:** Support\
**Created:** [August 19, 2019, 4:07am UTC](https://discourse.slicer.org/t/how-to-import-slicer-in-python-cli/8083 "2019-08-19T04:07:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joechenrh](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@joechenrh](https://discourse.slicer.org/u/joechenrh)\
**Post date:** [August 19, 2019, 4:07am UTC](https://discourse.slicer.org/t/how-to-import-slicer-in-python-cli/8083/1 "2019-08-19T04:07:19Z")

</div>

Hi,  
I’m trying to use python-cli to save node and upload to remote server. But I got error when using saveNode. How can I use these functions in python-cli?  
Thanks.

Traceback (most recent call last):  
File “C:/Users/chen/Desktop/SlicerRadiomicsCLI/SlicerRadiomicsCLI.py”, line 48, in  
main()  
File “C:/Users/chen/Desktop/SlicerRadiomicsCLI/SlicerRadiomicsCLI.py”, line 42, in main  
slicer.util.saveNode(getNode(‘1’), ‘1.nii.gz’)  
AttributeError: ‘module’ object has no attribute ‘util’

---

<div class="post-metadata">

**Author:** ![joechenrh](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@joechenrh](https://discourse.slicer.org/u/joechenrh)\
**Post date:** [August 20, 2019, 6:02am UTC](https://discourse.slicer.org/t/how-to-import-slicer-in-python-cli/8083/2 "2019-08-20T06:02:07Z")

</div>

Sorry, currently I meet another problem. Can I exchange data with process created by CLI?  
For example, in CLI, I have

```python
Queue.put(data)

```

and in main process

```python
if not Queue.empty():
    data = Queue.get()

```

---

<div class="post-metadata">

**Author:** ![Sam\_Horvath](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sam_horvath/32/3092_2.png) [@Sam\_Horvath](https://discourse.slicer.org/u/Sam_Horvath)\
**Post date:** [August 20, 2019, 3:06pm UTC](https://discourse.slicer.org/t/how-to-import-slicer-in-python-cli/8083/3 "2019-08-20T15:06:25Z")

</div>

Generally, CLIs are not intended to have direct access to the Slicer scene / infrastructure. They are meant for non-interactive data processing with non-slicer libraries. If you want to work within the Slicer environment, you should keep the code within a python scripted module.
