How to copy component instance to current page from another page with main component

Find the required PageNode using figma.root, find the desired ComponentSetNode using, for example, findAllWithCriteria, get the id of one of the children and create an instance (figma.getNodeById(id).createInstance()) or get the defaultVariant and create an instance.