# Basic question: What is 'Rhino' & 'scriptcontext' when we typing 'import rhino' & 'import scriptcontext'?

**URL:** <https://discourse.mcneel.com/t/basic-question-what-is-rhino-scriptcontext-when-we-typing-import-rhino-import-scriptcontext/126131>\
**Category:** Rhino Developer\
**Tags:** windows, python\
**Created:** [June 17, 2021, 2:07pm UTC](https://discourse.mcneel.com/t/basic-question-what-is-rhino-scriptcontext-when-we-typing-import-rhino-import-scriptcontext/126131 "2021-06-17T14:07:06Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![fmyl](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/fmyl/32/617283_2.png) [@fmyl](https://discourse.mcneel.com/u/fmyl)\
**Post date:** [June 17, 2021, 2:07pm UTC](https://discourse.mcneel.com/t/basic-question-what-is-rhino-scriptcontext-when-we-typing-import-rhino-import-scriptcontext/126131/1 "2021-06-17T14:07:07Z")

</div>

Hi guys, I`m just starting to learn rhino python. Recently i`ve read some python script in the forum, and notice that sometime we need to import rhino and scriptcontext. What are these files? Where could I find introduction about these 2 files?

I only find introduction about importing Rhinoscriptsyntax in this page:  
[https://developer.rhino3d.com/guides/rhinopython/python-rhinoscriptsyntax-introduction/](https://developer.rhino3d.com/guides/rhinopython/python-rhinoscriptsyntax-introduction/)

But nothing about importing rhino and scriptcontex. Is it a must-have before scripting everytime? Or we do it when needed?

If it is a ‘do-when-needed’,then when do we need to import them and what function they have? Could ‘Rhinoscriptsyntax’ replace both/either of them?

Many thanks

---

<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:** [June 18, 2021, 3:36am UTC](https://discourse.mcneel.com/t/basic-question-what-is-rhino-scriptcontext-when-we-typing-import-rhino-import-scriptcontext/126131/2 "2021-06-18T03:36:12Z")

</div>

Hey @fmyl,

There is lots of good “getting started” info here:

> **[Rhino.Python Guides](https://developer.rhino3d.com/guides/rhinopython/)**
>
> Quickly add functionality to Rhino or automate repetitive tasks.

– Dale

---

<div class="post-metadata">

**Author:** ![fmyl](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/fmyl/32/617283_2.png) [@fmyl](https://discourse.mcneel.com/u/fmyl)\
**Post date:** [June 18, 2021, 5:45am UTC](https://discourse.mcneel.com/t/basic-question-what-is-rhino-scriptcontext-when-we-typing-import-rhino-import-scriptcontext/126131/3 "2021-06-18T05:45:46Z")

</div>

Thanks Dale，working on it.

But I didnt find any page explains about ‘Import rhino’ & ‘Import scriptcontext’ and there is no explain about what commons or functions are contained in these two files as well.

On the other hand, ’ Import RhinoScriptSyntax’ is clearly explained, I know why I need importing RhinoScriptSyntax, and what commons or functions it contains in this following pages:

> **[RhinoScriptSyntax in Python](https://developer.rhino3d.com/guides/rhinopython/python-rhinoscriptsyntax-introduction/)**
>
> This guide provides an overview of the RhinoScriptSyntax in Python.

> **[rhinoscriptsyntax](https://developer.rhino3d.com/api/RhinoScriptSyntax/)**

My aim is to find explaination about ‘import rhino’ and ‘import scriptcontext’ like the explaination of ‘import RhinoScripSyntax’ to help me understand them clearly.

Do you know any specific page to do so?

Thanks again.

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [June 18, 2021, 6:13am UTC](https://discourse.mcneel.com/t/basic-question-what-is-rhino-scriptcontext-when-we-typing-import-rhino-import-scriptcontext/126131/4 "2021-06-18T06:13:44Z")

</div>

> [@fmyl](#):
>
> `Recently i` ve read some python script in the forum, and notice that sometime we need to import rhino and scriptcontext. What are these files? Where could I find introduction about these 2 files?

`import Rhino` refers to loading the [RhinoCommon API](https://developer.rhino3d.com/api/RhinoCommon/html/R_Project_RhinoCommon.htm). `rhinoscriptsyntax` for instance is just a wrapper on top of that, meaning that it has some functions simplifying usage for beginners that call API symbols (functions, classes, etc.).  
Superficially, it also applies a sort of functional programming logic, whereas the API goes full OOP (object oriented programming).

You can use the `inspect` module to well inspect underlying code, like this:

```python
import rhinoscriptsyntax as rs
import inspect

print inspect.getsource(rs.AddPoint)

```

This will output:

```python
  def AddPoint(point, y=None, z=None):
    """Adds point object to the document.
    Parameters:
      point (point): a point3d or list(x,y,z) location of point to add
    Returns:
      guid: identifier for the object that was added to the doc
    Example:
      import rhinoscriptsyntax as rs
      rs.AddPoint( (1,2,3) )
    See Also:
      IsPoint
      PointCoordinates
    """
    if y is not None: point = Rhino.Geometry.Point3d(point, y, z or 0.0)
    point = rhutil.coerce3dpoint(point, True)
    rc = scriptcontext.doc.Objects.AddPoint(point)
    if rc==System.Guid.Empty: raise Exception("unable to add point to document")
    scriptcontext.doc.Views.Redraw()
    return rc

```

There is no documentation about `scriptcontext`, as far as I know. It’s a very small Python script with only three functions that mostly handles interactions with the active Rhino document, and externalizes some other functionality, like for instance the persistent `sticky` dictionary that exists beyond the current Rhino instance (?), or the `id` variable.  
You can check out the code yourself. Just find the relevant Python file on your system. This will give you the path:

```python
import scriptcontext as sc

print(sc. __file__ )

```

The same goes for `rhinoscriptsyntax`.

---

<div class="post-metadata">

**Author:** ![fmyl](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/fmyl/32/617283_2.png) [@fmyl](https://discourse.mcneel.com/u/fmyl)\
**Post date:** [June 18, 2021, 12:47pm UTC](https://discourse.mcneel.com/t/basic-question-what-is-rhino-scriptcontext-when-we-typing-import-rhino-import-scriptcontext/126131/5 "2021-06-18T12:47:56Z")

</div>

Thank you Diff-arch. It`s so clear and understandable. I`d like to ask a bit further, is that mean I have no need to import rhinoscriptsyntax and scriptcontext if I import Rhino at first?

---

<div class="post-metadata">

**Author:** ![bahman.farshbaf](https://avatars.discourse-cdn.com/v4/letter/b/7cd45c/32.png) [@bahman.farshbaf](https://discourse.mcneel.com/u/bahman.farshbaf)\
**Post date:** [June 18, 2021, 1:09pm UTC](https://discourse.mcneel.com/t/basic-question-what-is-rhino-scriptcontext-when-we-typing-import-rhino-import-scriptcontext/126131/6 "2021-06-18T13:09:20Z")

</div>

You need to import anything that is needed. There is not any priority to import which one first.  
if Your code only needs Rhino syntax to run, u have to import that one only…and so on…

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [June 18, 2021, 4:00pm UTC](https://discourse.mcneel.com/t/basic-question-what-is-rhino-scriptcontext-when-we-typing-import-rhino-import-scriptcontext/126131/7 "2021-06-18T16:00:36Z")

</div>

You’re welcome! As @bahman.farshbaf already pointed out, you `import` what you need. It’s as simple as that!

---

<div class="post-metadata">

**Author:** ![fmyl](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/fmyl/32/617283_2.png) [@fmyl](https://discourse.mcneel.com/u/fmyl)\
**Post date:** [June 18, 2021, 4:56pm UTC](https://discourse.mcneel.com/t/basic-question-what-is-rhino-scriptcontext-when-we-typing-import-rhino-import-scriptcontext/126131/8 "2021-06-18T16:56:29Z")

</div>

Thank you Bahman, simple and clear. gonna digging more on these three files.

---

<div class="post-metadata">

**Author:** ![fmyl](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/fmyl/32/617283_2.png) [@fmyl](https://discourse.mcneel.com/u/fmyl)\
**Post date:** [June 18, 2021, 4:58pm UTC](https://discourse.mcneel.com/t/basic-question-what-is-rhino-scriptcontext-when-we-typing-import-rhino-import-scriptcontext/126131/9 "2021-06-18T16:58:36Z")

</div>

Totally understand, i m going to go through more scripts to figure out when-which thing.
