The Scripting API supports creating, editing, and deleting organizational entities like Sets and Structures. The Script below provides an example of creating Sets; note that the process is the same for Structures. It is written to be compatible with the Script Runner and makes use of the hyperx Python package.
import hyperx as hx
def Run(db_):
db = hx.Application(db_)
project = db.ActiveProject
# Grab the collection of sets in the current project,
# and add a new one named "Example Set"
setsInProject = project.Sets
newSet = setsInProject.Create("Example Set")
# Create a tuple containing the zone IDs that should be
# added to the set
zoneIds = tuple([1, 2, 3, 4])
status = newSet.AddZones(zoneIds)
if status == hx.CollectionModificationStatus.Success:
print(f"Successfully created new set {newSet.Name}!")