The short answer: no direct UI-to-Python export exists today. The feature you are
describing is a genuine gap – and you are not alone in asking for it. An earlier
thread covers the same ground with an official staff response:
Related: Converting Action Graphs to scripts
– staff confirmed in 2023 that direct conversion is not available, and the
recommended path is to use the Python scripting API.
Here is what is available as a workaround:
Option 1 – Read the graph from USD
OmniGraph graphs are stored as standard USD prims on the stage. After building a graph
in the Action Graph editor, you can save the scene as .usda (human-readable ASCII
USD) and inspect the graph structure directly. Every node type, attribute value, and
connection is represented as USD attributes on prims under your graph path (e.g.,
/action_graph/OnPlaybackTick, etc.). You can write a short script to traverse those
prims and reconstruct the equivalent Python calls from the data.
Option 2 – Use og.inspect().as_json() as a reference
The omni.graph.core inspection API can serialize the current graph state to JSON:
import omni.graph.core as og
graph = og.get_graph_by_path("/action_graph")
print(og.inspect().as_json(graph))
This outputs the node types, connections, and attribute values in a structured format.
It is not a Python script generator, but it gives you everything you need to write
the equivalent og.Controller.edit() block.
Option 3 – Rebuild in Python using og.Controller
The official path for programmatic graph creation is og.Controller:
import omni.graph.core as og
og.Controller.edit(
{"graph_path": "/action_graph", "evaluator_name": "execution"},
{
og.Controller.Keys.CREATE_NODES: [
("OnPlaybackTick", "omni.graph.action.OnPlaybackTick"),
("PrintText", "omni.graph.action.PrintText"),
],
og.Controller.Keys.CONNECT: [
("OnPlaybackTick.outputs:tick", "PrintText.inputs:execIn"),
],
og.Controller.Keys.SET_VALUES: [
("PrintText.inputs:text", "Hello World"),
],
},
)
Full walkthrough: OmniGraph via Python Scripting Tutorial
For common robotics graphs (differential controller, ROS bridge setups, etc.) there
are pre-built shortcuts under Tools > Robotics > OmniGraph Controllers that
generate the graph with a few clicks and are themselves backed by Python – you can
read those functions as examples of what the Python equivalent looks like.
The “build in UI, export as Python” round-trip you are describing would be a useful
feature and I am logging this as a feature request. In the meantime, Options 1 and 2
above give you the graph description in a machine-readable form that makes writing
the Python version straightforward.
Closing this thread. If you have follow-up questions on the Python scripting API,
please open a new topic and reference this one.