Working with objects in the API is often easier to understand using a specific example than it is from the documentation alone. You can easily create such example scripts yourself by creating a small model and then exporting it as a Python file.
How do I export an RFEM/RSTAB model to a .py file?
This can be done very easily using the export function in the user interface:
File => Export => Python Script | Dlubal API | gRPC
After the export, you can open the generated .py file in your preferred IDE, study the code, and derive your own scripts from it.
Note
Not all objects can be fully represented in a .py file when exported. Some model elements or settings may therefore not be included in the script.