Ren'Py Renpy 8 import ModuleNotFoundError

maximusleroy

Member
Aug 26, 2016
160
698
In renpy 7 you could import a module and from within the module you import other files using a relative path.
Code:
import shader

##in shader.__init__
import utilsutils
In renpy 8 you need to add the module name to any import within the module to another file in the module, otherwise it raises a ModuleNotFoundError.
Code:
import shader

##in shader.__init__
import shader.utilsutils
Is there a way to restore the renpy 7 behavior in renpy 8?
 

maximusleroy

Member
Aug 26, 2016
160
698
I was able to fix the problem by adding
renpy.add_python_directory("shader/")

Is there a way to automatically add the child directories, or do I have to add them one by one?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
Is there a way to automatically add the child directories, or do I have to add them one by one?
Putting the module where Ren'Py expect them, therefore in " ", should fix the issue.