Add an instrument resource dynamically?

Is it possible to create an Instrument/ScpiInstrument at run time within a Teststep?
Create, open, use and close, all from a Teststep (PreRun,Run,PostRun)?

1 Like

@GoranJohnsson you may be able to do this by creating a new instrument and calling the Open/Close methods directly. Can you share a bit more on why you need this so we can help provide a recommendation?
At a minimum, it seems like you may want to type of dummy Instrument that you manage all of this under.

We also have the concept of a short lived connection, which depending on what you are trying to do, may work better.

You should be able to create and use an Instrument from within a test step. However, I believe you’ll be responsible for calling all of its methods (Open, PreRun, Run, etc).

1 Like

Yes, it seems to work to create an instrument (I guess you have to create a dummy class since ScipInstrument (and Dut) are abstract classes) and then instansiate/open/use/close as needed from within the teststep.
Sometimes the resource cannot be opened until UUT is powered up (a virtual serial port on the UUT) and you need more explicit control.