In [1]:
import visa
rm = visa.ResourceManager()
if len(rm.list_resources())==0:
	print('No Device Found.')
else:
	print('Device Found:', rm.list_resources())
try:
    cm22c = rm.open_resource("COM3")
    print("COM3 Successfully Connected")
except:
	print('Error')
	exit()


No Device Found.
Error

In [6]:
strInsId=cm22c.query("*idn?")
strTempInputA=cm22c.query("input? a")
strTemUnitA=cm22c.query("input a:units?")
strLoopOnOff=cm22c.query("control?")
if(cm22c.query("input a:units k;:*OPC?")):
	print("Input A Unit set to K")
if(cm22c.query("LOOP 1:SETPOINT 273;:*OPC?")):
	print('LOOP 1 Setpoint set to 273')


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-6-0013e21ad0ee> in <module>()
----> 1 strInsId=cm22c.query("*idn?")

NameError: name 'cm22c' is not defined

In [ ]: