UnityEditor functional equivalent to pressing 'apply' on a prefab?

I’m attempting to figure out what the programmatic equivalent of pressing ‘apply’ in the inspector for a prefab is. I have a prefab that I want to attach another prefab to. It seems as I must first instantiate both prefabs, then parent one to the other, then press the apply button manually, then delete those items from my scene.

Perhaps I’m just missing it, but I don’t see a function that does what I want. Thanks in advance!

PrefabUtility

it’s for editor scripts though. Keep that in mind.

Look for specifically PrefabUtility.ReplacePrefab

Nice! I will check this out. Thanks!