How can I attached a component to either a parent component or parent model?

You do not attach definitions to anything. They are members of the model’s definition collection.

You attach component instances to entities collections using the function:
SUEntitiesAddInstance( parent_entities, instance, instance_name )
In this function’s parameter list … "parent_entities" can reference either the model’s top level entities collection or a component (or group) definitions’s entities collection.

See this post for how to create a definition and add an instance of it to an entities collection referenced by the identifier "entities". (In the example this is referencing the model’s top level entities collection.)
SUEntitiesFill throw the exception: Access violation reading location 0x0000000000000000 - #4 by DanRathbun