Arduino USB and PyFirmata

I have Arduino library the leverages PyFirmata. This library is called each time a Thread is started, and I need to access the Arduino on the same port. Is it possible to do this? The Arduino sleeps for 60 seconds but another instance is created during this time of the Arduino but a serial exception is raised that com port is busy.

def init(self, logger=None):

 self.logger = logger

 self.openboards = []

 comList =

 boardsConnected = []

 for element in comList:

    if 'Arduino Mega' in element.description:


 for i in range(0, len(boardsConnected)):

    connected = str(boardsConnected[i])

    port = connected.split(' ')

    megaPort = port[3].replace('','')

    megaPort = megaPort.strip("()")


  self.board = pyfirmata.ArduinoMega(megaPort)


 except serial.serialutil.SerialException:

     print('Problem connecting to Arduino. Comm port may already be in use. Checking and trying to fix...')

 for i in range(2, 14):[i].write(1)

 for i in range(22, 28):[i].write(1)

As you have found out the computer only allows you to access one thing with one port. If you close that port down and then access it again the Arduino will reset, it is designed to do this.