# ScriptContext Context

**URL:** <https://discourse.mcneel.com/t/scriptcontext-context/152168>\
**Category:** Rhino Developer\
**Tags:** windows\
**Created:** [December 15, 2022, 6:30pm UTC](https://discourse.mcneel.com/t/scriptcontext-context/152168 "2022-12-15T18:30:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike24](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mike24/32/642495_2.png) [@Mike24](https://discourse.mcneel.com/u/Mike24)\
**Post date:** [December 15, 2022, 6:30pm UTC](https://discourse.mcneel.com/t/scriptcontext-context/152168/1 "2022-12-15T18:30:11Z")

</div>

1. Is there documentation online somewhere for ScriptContext? I have looked in the scriptcontext.py file on my machine at C:\Users\<user\>\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib and that has very limited information. It hardly lists anything.

2. What’s the difference between sc.doc.Objects and sc.doc.ActiveDoc.Objects? The same goes for other properties and methods like Open(), BeginUndoRecord(), etc. If they are the same then what’s the purpose in having an ActiveDoc class? There must be a difference between the two. I have seen many scripts reference sc.doc.Objects and not sc.doc.ActiveDoc.Objects.

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/685184_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [December 15, 2022, 7:18pm UTC](https://discourse.mcneel.com/t/scriptcontext-context/152168/2 "2022-12-15T19:18:54Z")

</div>

Hi @Mike24,

You’re correct, there isn’t much in [scriptcontext.py](https://github.com/mcneel/rhinoscriptsyntax/blob/rhino-6.x/Scripts/scriptcontext.py).

The primary uses are to:

1. Provide access to the document that was active when the script is executed.
2. Provide access a global dictionary that can be used to store values between script executions.

Also, `ActiveDoc` is not reliable, as Rhino for Mac can have multiple docs open and there can be a pseudo document used in the context of Grasshopper. Using `scriptcontext.doc` is best as it lets you use the appropriate `RhinoDoc` in the context of the script being run.

– Dale

---

<div class="post-metadata">

**Author:** ![Mike24](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mike24/32/642495_2.png) [@Mike24](https://discourse.mcneel.com/u/Mike24)\
**Post date:** [December 15, 2022, 9:24pm UTC](https://discourse.mcneel.com/t/scriptcontext-context/152168/3 "2022-12-15T21:24:36Z")

</div>

@dale - Thanks so much Dale!
