Console
When using Patchwork 3D console ( menu), the interpreter is initialized with the following script:
from p3dsdk import *
p3d = CurrentP3DSession()
So you can send commands to the running Patchwork 3D instance using the p3d variable.
The following function is also defined for convenience: