# PythonScript class

Namespace: [Rhino.Runtime](https://developer.rhino3d.com/api/rhinocommon/namespace/rhino.runtime.md) · Assembly: [RhinoCommon](https://developer.rhino3d.com/api/rhinocommon/assembly/rhinocommon.md)

```cs
public abstract class PythonScript
```

Represents a Python script.

## Constructors

- [PythonScript](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/ctor.md): Initializes a new instance of the [PythonScript](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript.md) class.

## Properties

- [ContextId](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/contextid.md): Gets or sets a context unique identified.
- [Output](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/output.md): Gets or sets the Python script "print()" target. By default string output goes to the Rhino.RhinoApp.Write function. Set Output if you want to redirect the output from python to a different function while this script executes.
- [ScriptContextCommand](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/scriptcontextcommand.md): Command associated with this script. Used for localiation
- [ScriptContextDoc](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/scriptcontextdoc.md): object set to variable held in scriptcontext.doc.
- [SearchPaths](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/searchpaths.md): (static) Get/Set additional search paths used by the python interpreter

## Methods

- [AddRuntimeAssembly](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/addruntimeassembly.md): (static) Add assembly to list of assemblies used by python
- [Compile](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/compile.md): Compiles a class in a quick-to-execute proxy.
- [ContainsVariable](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/containsvariable.md): Determines if the main scripting context has a variable with a name.
- [Create](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/create.md): (static) Constructs a new Python script context.
- [CreateTextEditorControl](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/createtexteditorcontrol.md): Creates a control where the user is able to type Python code.
- [EvaluateExpression](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/evaluateexpression.md): Evaluates statements and an expression in the main scripting context.
- [ExecuteFile](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/executefile.md): Executes a Python file. The file is executed in a new, __main__ scope.
- [ExecuteFileInScope](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/executefileinscope.md): Executes a Python file in the calling script scope. All old variables are kept.
- [ExecuteScript](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/executescript.md): Executes a Python string.
- [GetSearchPaths](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/getsearchpaths.md): Protected helper function for static SearchPaths
- [GetStackTraceFromException](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/getstacktracefromexception.md): Retrieves a meaningful representation of the call stack.
- [GetVariable](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/getvariable.md): Gets the object associated with a variable name in the main scripting context.
- [GetVariableNames](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/getvariablenames.md): Retrieves all variable names in the script.
- [RemoveVariable](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/removevariable.md): Removes a defined variable from the main scripting context.
- [RuntimeAssemblies](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/runtimeassemblies.md): (static) Get list of assemblies used by python for library browser and inclusion into the runtime
- [SetIntellisenseVariable](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/setintellisensevariable.md): Sets a variable for runtime introspection.
- [SetSearchPaths](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/setsearchpaths.md): Protected helper function for static SearchPaths
- [SetupScriptContext](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/setupscriptcontext.md): Setups the script context. Use a RhinoDoc instance unless unsure.
- [SetVariable](https://developer.rhino3d.com/api/rhinocommon/type/rhino.runtime.pythonscript/setvariable.md): Sets a variable with a name and an object. Object can be null (Nothing in Visual Basic).
