Importing Non-Standard Python Modules to Be Used in Scripts

I am attempting to import pygames into my script so that I may have more robust control over how my controller works. However whenever I try to run the script I get the error: “Error running script cannot import base from pygame”. I wish I knew what exactly this error meant, but after scouring the internet nothing has turned up.

Here’s the snippet of code for how I’m importing the module. I also have the pygame folder in site-packages of Python27, Mission Planner, and the directory of my python script.

import sys sys.path.append(r"D:\Python27\Lib\site-packages") sys.path.append(r"D:\Python27\Lib") import math, os from time import sleep import pygame from pygame.locals import *

Did you ever figure out the right way to import modules? I am new to both Python and Mission Planner and am trying to write a script using ttsx. I have no idea how to get MP to find and use the module. Thanks!


Mp uses ironpython. so it the module has ironpython support it will work.
Pygame however I don’t think is on the supported list.

So there is no way to use any modules other than Ironpython?

Anything you can import in IronPython you can use. If it’s not supported within IronPython, you can’t run it within Mission Planner’s own environment.

You can, however, use the pymavlink module in a standalone app, which may offer more flexibility.