ok, i managed it to work. Removing Local $CmBoBaudOptic = 19200 ; Baud Local $CmBoBaudScanner = 115200 ; Baud from top of the script and placing it within desired functions SendData2() and SendDataOPTICS() like below: Func SendDataOPTIC($FileName, $LineNumber) $CmBoBaudOptic = 19200 ; Baud ;Start up communication _CommSwitch($CMPortOptic) (...) and Func SendData2($FileName, $LineNumber) $CmBoBaudScanner = 115