8 PyOrigin in Embedded Python

It is recommended that you switch to the originpro package. PyOrigin is primarily for users who need to work with Origin version prior to 2021.


In your Python code, you can import the PyOrigin module and make use of the functions it provides to access Origin objects.

Import the PyOrigin Module

To import the PyOrigin module, make sure to have the following command line in your .py file:

import PyOrigin

Note that the PyOrigin module provides for interaction between the current Origin session and the Python extension, so the .py files with imported PyOrigin module can only be called from Origin (See the section of Run Python from a File in Origin). Such .py files cannot be executed directly from an external Python editor (e.g. IDLE).

Inspect Functions Provided by PyOrigin

To see all the functions/global variable and classes/member functions accessible from embedded Python, you can run the following LabTalk script in the Script Window:

//make sure the Script Execution Mode is LabTalk
string str$ = system.PATH.PROGRAM$ + "\Samples\Python\ListMember.py";
run -pyf "%(str$)";

The functions/classes/global variables provided by the PyOrigin module are introduced in the following chapter: PyOrigin Classes, and PyOrigin Global Functions.

This section covers the following topics: