I'm trying to understand why instantiated module variables will not reset after they have been modified once after they are imported. I've been working with minimalmodbus
, and I am trying to reset the Baud rate if the default does not match the connected device's. Setting my own default, I cannot get the re-initialization of of minimalmodbus
to change the baud rate. For example:
import minimalmodbus
minimalmodbus.BAUDRATE=9600
comm=minimalmodbus.Instrument('COM4',1) #baud rate set to 9600 here for comm
minimalmodbus.BAUDRATE=19200
comm=minimalmodbus.Instrument('COM4',1) #attempting to change baud rate
print comm #displays all information, and showing that baudrate=9600, not 19200
I've had this issue using several other modules and I would really like to understand why this is occurring.
Aucun commentaire:
Enregistrer un commentaire