Trying to build a panda with RenderPipeline
using Setuptools
, I encountered ambiguous behavior.
When using the importlib package, it is impossible to find the module.
I have modified the asteroids example to demonstrate the problem.
from direct.showbase.ShowBase import ShowBase
#import test
import importlib
class AsteroidsDemo(ShowBase):
def __init__(self):
ShowBase.__init__(self)
#test.ptest()
importlib.import_module("test").ptest()
demo = AsteroidsDemo()
demo.run()
test.py
def ptest():
print("Hello world")
There are two options for importing the module. Both work without packaging. However, after packaging, only the option that is commented out is workable.
The importlib
option cannot find the module for some reason.
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
Traceback (most recent call last):
File "__main__", line 12, in <module>
File "__main__", line 10, in __init__
File "importlib", line 127, in import_module
File "importlib._bootstrap", line 1006, in _gcd_import
File "importlib._bootstrap", line 983, in _find_and_load
File "importlib._bootstrap", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'test'