Create transition from state machine to regular state via code?

I’m using UnityEditor.Animations to construct an animator controller via code, but I’m running into an issue

I want to create a transition from a state machine to a regular state, like this

most recently I’ve tried to do it like this
AnimatorTransition fromPlay = playState.AddStateMachineTransition(playState, emptyState);
but it doesn’t seem to work.
what am I doing wrong?

oh i got it. i need to call AddStateMachineTransition from the parent state machine like this
AnimatorTransition fromPlay = rootStateMachine.AddStateMachineTransition(playState, emptyState);