Rhino.Geometry commands like GetSegments() not working in CPython & Flask

Hi Dale, thanks again for your patience. This somewhat explains my confusion.
*EDIT: To explain, we need to move our processes to CPython (our project is much larger than this definition and there are parts that involve pandas and large dataframes). I’m using Hops because I’m trying to ‘break’ a specific curve that is generated in a GH file, and then I want to use rhinoinside to do the headless calculations. I’m trying to make this work to learn how Rhino.Inside works so that I can use RhinoCommon outside of gh/IronPython and move on to the more complicated definitions (for which I will need rhinoscriptsyntax as well, but I’ll tackle that later) and put them all in a single code. I hope I managed to explain myself.

I have a definition that breaks a curve into segments using an angle (I know there’s a method in RhinoCommon that’s supposed to do that but it seemed to not work well for us).

This is my original script that I’ve been using in my Python component inside GH and it worked great so far:

import Rhino.Geometry as rg
import rhinoscriptsyntax as rs
import math

def breakpolyline(polylines, tolerance):
    if len([polylines]) > 0:
        """Break a polyline into individual lines by an angle
        difference."""
        break_crv = []
        break_pts = []
        for crv in polylines:

            end_pts = []

            crv_pl = crv.ToPolyline()
            exp_crvs = rg.Polyline.GetSegments(crv_pl)
            for i, crv_new in enumerate(exp_crvs):
                end_pt1 = rg.Line.PointAt(crv_new, 0)
                end_pts.append(end_pt1)
                end_pt2 = rg.Line.PointAt(crv_new, 1)
                end_pts.append(end_pt2)
                new_i = (i + 1) % len(exp_crvs)
                vector = crv_new.Direction
                crv_2nd = exp_crvs[new_i]
                vector_2 = crv_2nd.Direction
                int_angle = rg.Vector3d.VectorAngle(vector, vector_2)
                int_deg = math.degrees(int_angle)
                if int_deg >= tolerance:
                    break_crv.append(new_i)

        end_pts_cull = rg.Point3d.CullDuplicates(end_pts, 0.001)
        for i, pt in enumerate(end_pts_cull):
            break_pt = break_crv.count(i)
            if break_pt > 0:
                break_pts.append(pt)

        cut_pt = []
        for pt in break_pts:
            t_crv = rg.PolylineCurve.ClosestPoint(crv, pt)
            cut_pt.append(t_crv[1])
        final_split = rg.PolylineCurve.Split(crv, cut_pt)

        return final_split, break_pts

I thought that in CPython importing Rhino.Geometry is imported directly from rhino.inside because of the discourse in this thread:

import rhinoinside
rhinoinside.load()
import Rhino
pt = Rhino.Geometry.Point3d(0., 0., 0.)

I thought that importing Rhino after rhinoinside.load() is the same as simply importing Rhino.Geometry as rg so that it would fit all my existing definitions.
Should I then use something along the lines of

from Rhino import Geometry as rg

If importing Rhino is using rhino3dm, how do I use Rhino.Inside commands specifically to ensure it works with rhino.inside instead of Rhino3dm?

Thank you so much

Lev