How to get hold of THREE instance from potree?

I am building a react based component using Potree viewer(from potreeconverter), enabling user to do free form selection(lasso) for a point cloud. This needs communication between parent react component and potree viewer inside iframe. So on my node backend, when index.html is served, I dynamically inject a custom js i index.html, and it contains all my custom js code to interact with potree viewer.

const injectScript = `<script src="/potree-custom/potreeviewer-utilities.js"></script>`
let modifiedData = data;
modifiedData = data + injectScript;

I am able to detect mouse clicks etc. Now I want to use THREEE raycaster api for further improvement. But I couldn’t get hold of THREE instance from potree.

Potree is available thanks to this in index.html:

But I can’t get hold of THREE instance.

What is correct way of doing so?

Do you have access to the “Scene” ? Maybe export THREE in the same place you get that scene access.

Yes, I have access to Scene. I would try your suggestion. BTW, I got this ‘Potree.Utils.getMousePointCloudIntersection’. This contains lots of utilities which I can use for my work even if I dont have direct access to an instance of THREE.