Question about using a Python serial port with Blender


I have a microcontroller I’m wanting to use as an external interface to Blender (game control w/display). I have it successfully communicating over the serial terminal in the Python console, but I am not aware how I am supposed to import the serial script into the code when I am in Blender itself. If I run this code in the Python console:

import serial
ser = serial.Serial(‘COM4’)

it works fine, and I receive the string on the microcontroller.
However, if I run it in Blender, I get an error that Blender cannot import the serial object. I have tried in both Blender 4.9 and 5.6.

I am experienced in programming, however I am new to Blender programming so if anyone could help I would appreciate it greatly.

Thanks in advance

if you’re using 2.5, possibly no serial module, or its named differently?

I downloaded the serial script off, and used the Windows installer to install the script in the python directory under the root directory.

Perhaps Blender is looking at different Python? I know that in 2.5 it’s bundled rather than looking in root for it… Pretty interested in this for much the same reason!

I’m interested by this post. Has anyone new answers to it ?
I have a microcontroller and i want it to “play” the game i designed in BGE.