Extend SCPI Class in Python

I am currently attempting to extend the Scpi class to create a custom step that will return the query response as an output. Right now, I am just testing with returning a hard-coded value while maintaining the normal functionality of the original Scpi class. This is my code:

@attribute(OpenTap.Display("SCPI Query", "Returns SCPI response", "Custom"))
class SCPIQuery(Scpi):
    # This is the output property that will be used by other steps
    ReturnValue = property(String,"Test")\
        .add_attribute(Display("Return Value", "", "Output", 0))\
        .add_attribute(Output())
    def __init__(self):
      super().__init__()
    def Run(self):
      super().Run()
      self.ReturnValue = self.ReturnValue + "10"

This is the log result:

How do I properly extend the Scpi class and use it in my Python plugin?

Hi @jrobin,

I am not completely sure what you are doing with self.ReturnValue

I think the class is called OpenTap.Plugins.BasicSteps.ScpiStep. So if you use that, I think your code should be valid.

It seems as though ScpiStep is not recognized either? I got rid of the ReturnValue just for clarity. The same error from above appears when I try this code.

@attribute(Display("Test", "Test", "A Test"))
class NewScpiStep(ScpiStep):
    def __init__(self):
        super().__init__() 
        
    def Run(self):
        super().Run()

Got it.

Well, for ScpiStep to be available to the scope when defining your class, so you need to import OpenTap.Plugins.BasicSteps (for example by from ... import ScpiStep.

And you might also need to add a reference to OpenTap.BasicSteps.dll by calling:clr.AddReference("OpenTap.Plugins.BasicSteps")