Python Resources for NI Hardware and Software


This document provides an overview of the National Instrument tools to use Python alongside the NI hardware and software platforms, including PXI, CompactDAQ, CompactRIO, LabVIEW, TestStand, and VeriStand. For each Python tool, refer to the linked documentation for installation instructions, supported environments, API reference, and examples.


Using Python APIs for NI Hardware

Open source developers and NI have made Python integration with NI hardware easy by creating modules that abstract the lower-level ctypes function calls into simplified APIs. The following links lead to documentation resources for Python wrappers that have been created for NI hardware drivers.

Python APIs for PXI Modular Instruments

The nimi-python repository is a collection of Python modules that provide an interface to the underlying NI modular instrument drivers. Currently, NI offers Python support through this package for PXI oscilloscopes, waveform generators, DMMs, SMUs, power supplies, switches, and digital pattern instruments. These instruments use the following drivers:

Modular Instrument


Python Module

PXI Oscilloscope



PXI Waveform Generator



PXI Digital Multimeter



PXI Programmable Power Supply

PXI Source Measure Unit



PXI Switch



PXI Digital Pattern Instrument

NI-Digital Pattern Driver


Learn more about nimi-python

Python API for DAQ Hardware

The nidaqmx package contains an API for interacting with the NI-DAQmx driver required to communicate your NI data acquisition (DAQ) device. This package was created and is supported by NI. The package is implemented as a complex, highly object-oriented wrapper around the NI-DAQmx C API using the ctypes Python library.


Python API for VirtualBench

The pyVirtualBench library provides an interface to the underlying VirtualBench driver by wrapping the C API.

pyVirtualBench is a third-party wrapper and is not directly supported by NI.


Python API for RIO Hardware

The NI FPGA Interface Python API is used for communication between processor and FPGA within NI reconfigurable I/O (RIO) hardware such as NI CompactRIONI Single-Board RIONI FlexRIO, and NI R Series multifunction RIO.

With the FPGA Interface Python API, developers can use LabVIEW FPGA to program the FPGA within NI hardware and communicate to it from Python running on a host computer. This gives engineers and scientists with Python expertise the ability to take advantage of compiled LabVIEW FPGA bitfiles and have the option to reuse existing Python code.

Learn more about FPGA Interface Python API

Python API for Vision Applications

The nivision library is a NI image/vision processing library that makes the functionality of NI Vision available in the Python programming language. It is available for multiple platforms including Windows and the CompactRIO.

: nivision is a third-party wrapper and is not directly supported by NI.

Learn more about nivision

Python API for CAN, LIN, and FlexRay Hardware

The nixnet package contains an API for interacting with the NI-XNET driver. NI-XNET is the driver software technology behind NI-XNET CAN, LIN, and FlexRay PCI, PXI, and NI C Series interfaces. The nixnet package and NI-XNET are supported by NI.

Learn more about nixnet

Python API for Traditional, Benchtop Instruments

PyVISA is a Python package that contains the API for interacting with the NI-VISA driver. NI-VISA enables you to control measurement instruments independently of the interface (e.g. GPIB, RS232, USB, Ethernet) and is the driver software technology behind NI serial, GPIB, and Ethernet PCI, PXI, USB, and NI C Series interfaces.

: PyVISA is a third-party wrapper and is not directly supported by NI.

Learn more about PyVISA

Calling NI Hardware DLLs Using ctypes

While Python modules with intuitive APIs exist for hardware communication with many devices, developers frequently rely on C APIs provided with most hardware drivers to integrate their Python code with hardware. The same methodology can be applied to using NI hardware with Python via the ctypes module. This solution provides an intuitive way to integrate Python scripts with most hardware components.


In addition to using the ctypes module to access a hardware driver's C API, LabVIEW can generate DLLs composed of hardware API functions that can be called from Python. This same procedure allows developers to abstract a sequence of hardware interactions into a single function call stored in the DLL file.

Integrating Python into LabVIEW

LabVIEW 2018 introduces the Python Node, which provides native capability to intuitively call a Python script from a LabVIEW Block Diagram.  It uses LabVIEW primitives, providing a way to interoperate between the languages with low latency. 

Calling Python from TestStand

Starting with TestStand 2019, the included Python Adapter offers an integrated, configuration-based experience for calling Python code modules from your test sequences. The adapter is built on the same design principles as other TestStand adapters, providing a development experience familiar to existing TestStand developers.

Using Python for VeriStand

Starting with VeriStand 2018, the niveristand package contains an API that interfaces with VeriStand systems. This package was created and is supported by NI.

Learn more about niveristand

Scripting Python in DIAdem

Starting with DIAdem 2020, Python is available in the SCRIPT module as an alternative scripting language to VBS. You only need to enable Python in the DIAdem SCRIPT settings as the script language if you prefer to use this language. As with VBS, you can alternatively record scripts in Python syntax. The Python editor integrated in the SCRIPT panel offers the usual auto-completion and a tooltip with syntax information and a short command description.

  • Find Python and VBS script shipping examples in NI Example Finder >> Creating Scripts

Was this information helpful?