Need help testing panda3d samples


I want to try out some samples and loaded scripts from GitHub, e.g. Carousel here.
But I can’t compile the script. There are some errors like “base is not definied”, “loader ist not defined” and so on (same errors for “render” and “camera”). What am I doing wrong?

Thanks in advance.

OS: Windows 10
Python: 3.11.5
Panda3D: 1.10.14

I found a solution: “self” must be added to the undefined objects/variables. So “self.base”, “self.render” and so on works.


Base, loader, camera, and render are all globals that should be automatically defined when showbase is created. Might I ask how you’re running the program?

I use the IDE Visual Studio Code for edit und run python scripts.

To elaborate: When the ShowBase instance is created, it adds base as a reference to itself in __builtins__; From that moment on, it is usable from any point in the code just as Python’s built-in functions are. As this is far from best practices on one hand, and on the other can only be inferred from the code by tools with extreme effort (which is why nobody does it), the IDE does not know about base. Python does not care though, so you should be able to run the code without problem; If the IDE stops you because it does not understand, that’s its fault.

1 Like