Seems there is some significant cost for using panda3d.core instead of pandac.PandaModules.
Subsequent imports should be close to free, but I discovered that using the new import method was adding a lot of time to load up my game.
I usually import * at the top of my py files that need to use Panda classes, in total I had 32 files with import *, so it was adding a good 10 seconds or more to the load time.
import time
start = time.time()
for i in range(0, 100):
from pandac.PandaModules import *
print 'import time', time.time() - start
start = time.time()
for i in range(0, 100):
from panda3d.core import *
print 'import time', time.time() - start
import time 0.018000125885
import time 42.260999918
Found the problem. It was just a matter of making panda3d.py cache the results of each call to getattr(), so that subsequent calls to retrieve the same symbol in the future don’t have to revisit the same codepath. Fix committed.