How to call C# based Plugins in Python?

In case you have an instrument or a DUT that has a plugin written in C#, you can still use that in a Python plugin very easily.

In the below example, "PowerAnalyzer" is an C# Instrument Plugin that is provided by "OpenTap.Plugins.Demo.Battery". It contains a measure current method.

We can use it in Python as shown below:

  1. Use clr.AddReference("<dll name>") to import the C# dll.
  2. Add the PowerAnalyzer as a setting for the python test step
  3. Call the PowerAnalyzer methods directly from python

2 Likes