Anything you can calculate within 1 comp, you can access or calculate from another comp, by preceding the dotsyntax with the compname instead of thisComp, like this:
l=comp(“comp 2”).layer(“layer 1”);
So as long as you can calculate it from within the precomp itself it should be no problem.
Example:
you have a comp with a layer that has a lensflare: “comp 1”
this comp is used as a 3D-layer in another comp: “comp 2”, here comp 1 has been rotated and scaled etc.
you want comp 1 to know in a textlayer, where the lensflare point winds up inside comp 2, so after layer space transforms:
a text-layer in Comp 1 could calculate like this:
l=thisComp.layer("Black Solid 1");
flare_2dpos=l.toComp(l.effect("Lens Flare")("Flare Center"));
l2=comp("Comp 2").layer("Comp 1");
l2.toComp(flare_2dpos);
Note that in line 3 you explicitly have to say in what composition comp 1 is used and as what layer.
Motionscript has no way of knowing by itself.
Deeper nesting is possible, just keep stacking layerTransform upon Layertransform.
But when you start collapsing 3D geometries… that’ll be a lot of headscratching an vector maths I think.