Access figure instance of dcc.Graph from external JS

I am trying to tweak my plots with JS similar to https://stackoverflow.com/a/47704082. To do that I need to access the actual plot instance (the <div> node) of dcc.Graph. I tried

var plot = document.querySelector("#graph-id .plotly");

but this does not seem to work, as the returned element does not have Plotly-specific methods such as .on() or .data. Does anyone know if this is possible?

AFAIK I don’t think it is possible to control the plot like this because it is controlled by React. But there might be ways to do it with a clientside callback if the purpose is the same of the OP in the link you shared. Is that the case?