Run Python Code
run_python_codeExecute custom Python code inside Ansys Electronics Desktop to automate design workflows and access the connected AEDT instance via PyAEDT.
Instructions
Execute Python code inside AEDT.
This tool runs inline Python code within the AEDT environment. The code
has access to the connected AEDT instance via the desktop variable.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "run_python_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The Python code to execute. The code has access to: - `desktop`: PyAEDT instance - `odesktop`: Native AEDT oDesktop COM object - `aedt_port`: gRPC port of the connected AEDT instance |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |