<div dir="ltr"><div>Hi Raymond</div><div><br></div><div>The general idea is that for every PyQGIS module (e.g. "core") there is a compiled python module (e.g. _core.so) and a directory acting as a module ("core") which imports the compiled module and adds some extra functionality (docstrings and more). So normally one wants to use import qgis.core instead of qgis._core.</div><div><br></div><div>Now with the 3d module things are not so great, because "3d" is not a valid module name because of the leading digit, so import qgis.3d simply won't work. There are some ways to work it around [1], but I wouldn't recommend using them. But as stated earlier, importing qgis._3d should generally do the job.</div><div><br></div><div>It is probably worth creating a ticket to address this, but I am not sure how to best fix it - probably the whole module should be renamed so avoid the leading digit - e.g. "threed"</div><div><br></div><div>[1] <a href="https://stackoverflow.com/questions/9090079/in-python-how-to-import-filename-starts-with-a-number">https://stackoverflow.com/questions/9090079/in-python-how-to-import-filename-starts-with-a-number</a></div><div><br></div><div><div>Cheers<br></div><div>Martin</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 3, 2022 at 8:58 AM Raymond Nijssen via QGIS-Developer <<a href="mailto:qgis-developer@lists.osgeo.org">qgis-developer@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
While trying to import a 3D class in a python script, I found out that <br>
the code in the pyqgis docs is not working (for me):<br>
<br>
from qgis.3d import QgsLayoutItem3DMap<br>
<br>
<br>
Instead I need to add an underscore for the 3d module name:<br>
<br>
from qgis._3d import QgsLayoutItem3DMap<br>
<br>
<br>
<br>
Should this be fixed in the documentation? I'm not all sure, cause when <br>
trying to fix it, I found this related commit:<br>
<br>
<a href="https://github.com/qgis/pyqgis/commit/1ac564790aa0b7abbd003c04d07358d8e4f14493" rel="noreferrer" target="_blank">https://github.com/qgis/pyqgis/commit/1ac564790aa0b7abbd003c04d07358d8e4f14493</a><br>
<br>
<br>
<br>
This is the page in the docs:<br>
<a href="https://qgis.org/pyqgis/master/3d/QgsLayoutItem3DMap.html" rel="noreferrer" target="_blank">https://qgis.org/pyqgis/master/3d/QgsLayoutItem3DMap.html</a><br>
<br>
<br>
Should I make an issue? It took me a while to figure out that _3d solution.<br>
<br>
Cheers,<br>
Raymond<br>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div>