Well, I was having issues getting pyserial and Maya to run for serial communications using python. I was getting the error “Error: No module named serial”

The solution:

Make sure that pyserial is installed, if not type the following on any command (CMD) window

python -m pip install pyserial

After it was installed, go to the python console and type:

  • import sys (hit enter)
  • sys.path (hit enter and it will return a list of paths of your python)
  • Modify the following mel script with your python paths and run it
global proc appendSystemPath(){
python( "import sys" );
python( "sys.path.append('C:/Python310/Lib/site-packages')" );
python( "sys.path.append('C:/Python310/Lib/site-packages/win32')" );
python( "sys.path.append('C:/Python310/Lib/site-packages/win32/lib')" );
python( "sys.path.append('C:/Python310/Lib')" );
}
appendSystemPath();

Then just run your python script as normal using the “import serial” line

import serial