Interactive Version
The interactive version of Syside Automator provides a command-driven interface for engaging directly with SysML v2 models through a terminal.
Such approach enables quick inspection, validation and modification of the model using structured commands, eliminating the need to create and execute Python scripts for simple and quick use-cases.
Note
Interactive mode runs an IPython shell when
IPython is installed, which is what this page shows. To get it, install Syside with
the ipython extra: pip install syside[ipython]. Without IPython, a plain
Python shell is used instead, with different prompts and less convenient multi-line
input.
Learn about:
Checking for Errors: Quickly identify errors in the model
Counting Parts: Run short scripts rather than full Python scripts
Complex Commands: Forming more complex commands interactively
Example Model: copy this model into your example_model.sysml file to test out
the features of Syside Interactive, or use your own model:
package 'Part Tree Example' {
part def Electrical;
part def Mechanical;
part Automobile {
part 'Drive Train' {
part Battery : Electrical;
part Motor : Electrical;
}
part Chassis {
part Suspension : Mechanical;
part Body : Mechanical;
}
}
}
Checking for Errors
In First Example, we showcased how to check the model for errors using
syside check. One other option is simply to try and load the model, since
load_model will automatically check the model for
errors and report them.
To demonstrate this, remove the line part def Electrical; from the model, and try
loading the model by running the following command:
python -m syside interactive example_model.sysml
This will automatically check the model for any errors. You should get an output similar to the following:
example_model.sysml:7:26: error (reference-error): No Type named 'Electrical' found.
7 | part Battery : Electrical;
| ^^^^^^^^^^
example_model.sysml:8:24: error (reference-error): No Type named 'Electrical' found.
8 | part Motor : Electrical;
| ^^^^^^^^^^
Counting Parts
One advantage of the interactive version is the ability to run simple scripts that do
not warrant a full Python script. Restore the part def Electrical; line removed in
the previous section and start the interactive session again:
python -m syside interactive example_model.sysml
Since the model is now valid, Syside drops into a shell with the model already loaded, greeting you with a banner similar to the following:
Python 3.14.2 (main, Dec 6 2025, 11:21:58) [GCC 14.3.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 9.15.0 -- An enhanced Interactive Python. Type '?' for help.
Welcome to isyside!
This is an interactive Python shell with the loaded model accessible as model.
Builtin modules: syside
Convenience variables: model, diagnostics
For example, we can count the number of parts in the model by running the following command:
In [1]: len(list(model.nodes(syside.PartUsage)))
Out[1]: 7
We see that it correctly counted the 7 parts in the model. Similarly, we can count the number of part definitions by running a slightly different command:
In [2]: len(list(model.nodes(syside.PartDefinition)))
Out[2]: 2
You could also use the same idea to count ActionUsage,
etc.
Complex Commands
Interactive mode works the same way as the Python API, so you can use the same functions and methods. However, sometimes you might need more than a single line of code to do something.
For example, we can list all the part definitions in the model by running the following command:
In [3]: for element in model.nodes(syside.PartDefinition):
...: print(element.name if element.name else "anonymous")
...:
Electrical
Mechanical
The interactive version will recognize when an extra line of code is needed (in this case - to define the for loop) and will prompt you to continue. To complete this loop, simply press Enter after inputting an empty line.
Once you are done using the interactive mode, you can exit by typing exit and
pressing Enter.