Referencing Other Parameters in Python
Use parameters defined on the page directly in your Python script by referencing them by name.
Last updated
Use parameters defined on the page directly in your Python script by referencing them by name.
Last updated
Any parameter created on your CalcTree page is automatically available in Python. To use it, simply start typing the parameter name in your script—it will appear in the editor’s autocomplete suggestions.
This is how you pass data from the rest of the page into Python.
Assume you have two parameters defined elsewhere:
width = 100 mm
height = 2.5 m
In Python:
The result is a unit-aware calculation, and the area
variable will be added as a new Python output parameter.
You do not need to re-declare or wrap input parameters with ct.quantity()
—they are already unit-aware.
If the parameter name is misspelled or undefined, you’ll receive an error at runtime.
This linking works across all source types: MathJS, spreadsheet tables, dropdowns, and other Python blocks.