How to run segment editor python script from Terminal

How can I run a python script from Terminal to create segmentation within slicer. I’ve read posts related to this but what my question boils down to is how to run the script itself from Terminal.
Lets say I am using this code here to create some segmentation. How should I go about running this? If I have this file saved in a folder on my Desktop how do I run this script from Terminal to operate on/within Slicer. Could someone help me find the code to begin this process start to finish. Whether the segmentation script itself works or not is not my question, just how would I use such a script within Terminal without using the Slicer GUI? I will also note that I am trying to apply this segmentation on a folder of DICOM files. Thank you in advanced.