[QGIS-Developer] import 3d or _3d in python?

Raymond Nijssen r.nijssen at terglobo.nl
Sun Oct 2 23:57:42 PDT 2022


While trying to import a 3D class in a python script, I found out that 
the code in the pyqgis docs is not working (for me):

from qgis.3d import QgsLayoutItem3DMap


Instead I need to add an underscore for the 3d module name:

from qgis._3d import QgsLayoutItem3DMap



Should this be fixed in the documentation? I'm not all sure, cause when 
trying to fix it, I found this related commit:

https://github.com/qgis/pyqgis/commit/1ac564790aa0b7abbd003c04d07358d8e4f14493



This is the page in the docs:
https://qgis.org/pyqgis/master/3d/QgsLayoutItem3DMap.html


Should I make an issue? It took me a while to figure out that _3d solution.

Cheers,
Raymond


More information about the QGIS-Developer mailing list