Extract component output from grasshopper in external python script

Given a grasshopper network that extracts the line length of a bounding box, can this computed
value be queried from an external script in python? Basically I want to be able to get the value plugged in to the panel view from an external script.

I am familiar with loading the grasshopper plugin via

import Rhino
gh = Rhino.RhinoApp.GetPlugInObject("Grasshopper")

However the available functions from that object don’t suggest being able to query a value.

Welcome,

You could use Hops - a component that allows you to communicate between the IronPython environment of Rhino (and Grasshopper) and CPython -, and either input the line that results from your Grasshopper definition, or even simply input the mesh and do everything in Python.

Thank you for the recommendation. I am trying to be os agnostic, though I forgot to mention that in my post.

I found it possible to go up the network and just query the mesh component directory for the bounding box and calculating my own length.

    mesh_data = mesh_component.VolatileData
    mesh_object = mesh_data[0][0]
    bb = mesh_object.Boundingbox

Hops works on both Windows and macOS, probably even Linux!