For exmaple, as follows, I can simply initialize my device by using following code if my device is connected properly.
from visa import *
my_instrument = instrument("GPIB::14")
But what if the device is not connected to the computer? What I want to do is that before I initialize the device, firstly I want to check whether the device is connected properly? How to achieve that?
You could do it two ways:
1) Check if it is in the get_instruments_list()
2) Try to connect and catch the exception, you will need to wait for the timeout to occur