Preferred Python Library for Modem Interaction?

Hi,

Is there a preferred python lib for working 3G/4G&LTE HATs? I’ve configured ECM, but I want to always prefix my script startup with the correct AT commands to make sure everything is usable.

Thanks,
-T

Hello @gamename ,

The serial python module can be used to communicate with module over the USB.

Basic example to issue an AT command using the serial python module is as follows:

import serial

ser = serial.Serial('/dev/ttyUSB2',115200)

def sendCommand(command):
	ser.write(command.encode())

if not ser.is_open:
	ser.open()

if ser.is_open:
	sendCommand("AT")
	ser.close()