Adding component to project programmatically through SDK

I have two components A and B in a custom module

I have only component A on the pallet

I desire that when component A is inserted into a project it also creates an instance of component B.

I have managed to get component B visible on the window but it does not show in the Project/Windows navigation tree at all.

What is the correct way to do this?

component A and B are based on AbstractVisionPanel, and one wishes to launch component B from the A.onStartup() method.