Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
On Mac, to add a custom/third-party module to your Ren'Py game, you only need to do the following (assuming a file called mymodule.py exists in the game directory):
python:
from sys import path
path.append('C:\\Users\\username\\Desktop\\mygame\\game')
import mymodule
Always results in:
WindowsError: [Error 126] The specified module could not be found
Changing the current working directory via os.chdir does not work.
Strangely, having this code removed and manually typing the commands into Ren'Py's console allows this to work. I am clearly doing something wrong but I have no idea what. Is there a significant difference as to how the Windows version of Ren'Py handles modules compared to how Mac version of Ren'Py handles modules or am I simply overlooking something very simplistic?
Last edited by AJFLink on Thu Apr 23, 2020 10:10 am, edited 1 time in total.
Why are you using an absolute path for imports... You will need to include the module files in your build anyway, so just put them inside ./game somewhere and relative path them
You can even add the folder (before using import) with
$ renpy.add_python_directory("subfolder/folder")
Ren'Py by default will add the (not existing) folder named "python-packages" so you could create a folder named exactly that (inside game/) and just import (presuming the module is just pure Python)