starting to migrate my project to the new panda and python version.
Got a BIG ISSUE!
I have a CoreGlobal.py script that make the same that all the …Global from Panda3d ie creating a single instance of Core to be available to all other objects.
This Core is the unique entry point to my project, No Core.py=no Project.
In previous Python version, its works perfect.
In latest version i’ve got this error:
File "E:\WG\ArkheniaFrameWork\binaries\Dragons_Server.py", line 21, in ?
from CoreGlobal import *
ImportError: No module named CoreGlobal
Does someone has an idea what is wrong? CoreGlobal.py is a script not a module right now.
I think you’re having the same problem as a lot of others. The problem is this - in the following import statement,
from direct.showbase.DirectObject import DirectObject
“direct” is the name of a subdirectory
“showbase” is the name of a subdirectory
“DirectObject” is the name of a file
“DirectObject” is the name of a class defined in that file
Unfortunately, the file and the class have the same name, so you have to be careful about which one you’re importing. If you say:
import direct.showbase.DirectObject
then you imported a pointer to the module. Ie, the variable “DirectObject” now points to the module, which in turn contains the class.
from direct.showbase.DirectObject import DirectObject
then you imported the class. Ie, the variable “DirectObject” contains a pointer to the class.