0 / 0
Creating nodes

Creating nodes

Flows provide a number of ways to create nodes. These methods are summarized in the following table.

Table 1. Methods for creating nodes
Method Return type Description
s.create(nodeType, name) Node Creates a node of the specified type and adds it to the specified flow.
s.createAt(nodeType, name, x, y) Node Creates a node of the specified type and adds it to the specified flow at the specified location. If either x < 0 or y < 0, the location is not set.
s.createModelApplier(modelOutput, name) Node Creates a model applier node that's derived from the supplied model output object.

For example, you can use the following script to create a new Type node in a flow:

stream = modeler.script.stream()
# Create a new Type node
node = stream.create("type", "My Type")
Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more