Set document sun north

Hi there! I’ve been racking my brain on this seemingly simple script. I wanted to create a script where I could control the north direction of the document sun by setting two points. I just can’t seem to figure out a way to control the document sun north? I can find the property with ScriptContext:

    import scriptcontext as sc

    sun = sc.doc.Lights.Sun


But I’m unsure of how I’d set the sun north.

You might find some help in looking at the example here:

(I am not at pc now)

That indeed did the trick! Here’s the little script I ended up with:

import Rhino
import rhinoscriptsyntax as rs
import math

ln = rs.GetLine(1, None, "First point", "Second point")
dir =  ln[1] - ln[0]

angle = math.degrees(math.atan2(dir.Y,dir.X))
angle = round((angle+360) % 360,1)
if angle == 360:
    angle = 0


RhinoSun = Rhino.RhinoDoc.ActiveDoc.Lights.Sun