connections = mc.listConnections() if connections: for connection in connections: #whatever you want the connections to do