Importing classes within the Blender game engine

Let’s suppose i have a package called for instance python_game and within that package i have a few classes to load data files like GameData and LoadSaveManager. I would like to use these classes inside python controller scripts by importing them with an import command like “from game_python import GameData, LoadSaveManager”. My question when the game is save to a runtime where are we supposed to copy our python_game folder containing the game classes so that python will find them when importing?

I don’t want to force players to install Python 2.5 to run my game, but i would still like to use packages like ElementTree to read xml data. Is there a way to install these packages with the game engine runtime so that Python can access it?

If you have the individual .py files, you can just put them in the same folder as your executable, or in another folder (maybe called “scripts”) as long as you tell your importing script where to find them.

OK i did that and it doesn’t fully work. What i did is creating a dir “python_game” in the same folder of the “start.exe” created by Blender with the “Save Game As Runtime…” menu. That dir contains an init.py file and a GameData.py file with a GameData class inside. The GameData class has a method called myprint().

So what i did was to attach a python controller script to an empty and execute a script that imports the class with "from python_game.GameData import GameData. It works and i can create an instance with “data=GameData()” but when i try to invoke the method with “data.myprint()” it complains the method doesn’t exist in the instance.

I tried doing this from a DOS prompt with the python command and it works ok.