Editor Scripting: calling a Property Drawer by reference

is there some way that I could call a property Drawer for a class from either a CustomInspector, or from a EditorWindow (essentially another Editor class)?

Context: I have gone through and made some property Drawers for classes, and was wondering if I could just call those PropertyDrawers in some CustomInspectors, so that I can get the same behavior, and appearance.

Well you could use the EditorGUI.PropertyField to have the system draw them for you.

Or you could hack around and retrieve the actual drawer for a given serialized property:

static Func<SerializedProperty, PropertyDrawer> getDrawer;

public static PropertyDrawer GetDrawer(SerializedProperty property)
{
    if(getDrawer == null)
    {
        var mtd = typeof(PropertyDrawer).GetMethod("GetDrawer", BindingFlags.NonPublic | BindingFlags.Static);
        getDrawer = (Func<SerializedProperty, PropertyDrawer>)Delegate.CreateDelegate(typeof(Func<SerializedProperty, PropertyDrawer>), null, mtd);
    }
    return getDrawer(property);
}

mostly solved by using the suggestion posted here by @Bunny83 though I have found that because I use List in several places that I need to find a different approach to getting at those.

// in [customInspector(typeof(ClassA))]
ClassA classA;
SerializedObject obj;
SerializedProperty property;

// in OnEnable
classA = (ClassA)target;
obj = new SerializedObject(classA);

// later in OnInspecotGUI
// CustomPropertyDrawer is for field named "data"
property = obj.FindProperty("data");
EditorGUI.PropertyField(GUILayoutUtility.GetRect(
    (float)Screen.width, EditorGUI.GetPropertyHeight(property) ),
    property);

this uses the CustomePropertyDrawer that was defined for the type “data” is