You first need to publish the file as a team library and then use the appropriate Plugin API methods.
-
figma.importComponentByKeyAsync(key)
; -
figma.importComponentSetByKeyAsync(key)
; -
figma.createComponent()
; -
ComponentNode.createInstance()
.
You can get some details in this thread: How access other file by Figma API.