How to import Slicer in python-cli

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?

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

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


and in main process

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

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.