Hello Tracychen,
You mean with Pysbs, right?
It depends on your use case, but the UID is a member of the class SBSCompNode which the highest object for any kind of node in a graph.
A simple snippet example to list all UID node:
from pysbs import context, substance
ctx = context.Context()
doc = substance.SBSDocument(ctx, "your_sbs_file.sbs")
doc.parseDoc()
graph = doc.getSBSGraph('New_Graph')
nodes = graph.getAllNodes()
for node in nodes:
print(node.mUID)