Importing external pthon modules

(gorgan_almi) #1

Is this a bug or a delberate security feature?

cose if its a security feature then its a pretty bulsey one, bit like the one introduced in 2.2x that stops seperate python scripts from sharing global variables and functions. :x

Why does whis make me so cross? Well I’m developing a game using event-based Python scripts a much as possible, and logic bricks as little as possible. My game only uses logic bricks to detect the events and launch the python scripts. This in my view is the best way forward, as it gives the programmer as much flexibility as possible. But for this method to work you needed to be able to share global variables and functions between scripts. When that was blocked I found I could get away with having the majority of my scripts as imported modules. But if that doesn’t work either in compiled exe’s then my method is impossible and my entire work useless!

If these are security features then you should be able to turn them on and off when editing the game. Does anyone know if importing modules will eventually be possible in compiled games?


P.S. Sorry for cross-posting but I felt this topic was relevent to both forums.

(saluk) #2

Yeah, I’ve found out myself that you can’t import external modules in exe’s :frowning:

This will hopefully be one of the first things to be changed during open source modifications.

You can get around global variables by attaching your functions, objects, and other variables to GameLogic.

If you make a function, say moveVert(vertnum,x,y,z), and then attach it to gamelogic: GameLogic.moveVert = moveVert

Then you can call the function anywhere: GameLogic.moveVert(blah)

(gorgan_almi) #3


THats really sideways thinking! :smiley:

Thanks. :smiley: