Is there any way to create my own module in qpython3 ? If there is, it would be great to fix my code properly, without going all the way down to fix just onde line.
-
1Please, clarify your question. It's not clear what you want to do. – Nurjan Oct 20 '16 at 05:33
3 Answers
well, i'm creating a game with 3 games inside it and i would like to put the game functions inside individual modules, like: from tictactoe import structureTictactoe from Chess import structureChess
then these functions when called simply print the specific game structure like the tictactoe grade and the chess table. For instance, it's simpler to edit the game functions inside individual modules

- 11
- 2
-
-
i'm sorry, i'm still a newbie. I guess i already find the answer. – André Ultrasi Oct 20 '16 at 05:54
You have to write the functions that you want into a .py script that has the same name as you want the module to be called. You then have to add that into the site packages directory and then you should be able to access them from anywhere. Just make sure that it is in the "qpython\lib\python3.2\packages\" directory

- 41
- 1
- 8
create your game library, such as myGameLib.py in your script's local directory.
Then from your main python code:
import from myGameLib *
Note that this will work. However, if you want to create a sub directory for your python lib, such as a local directory to your script, /mysubdir,
import from mysubdir.myGameLib *
appears to be broken in QPython3.

- 1
- 2