Nicorocas
New Contributor

I am creating a script with thearcpy.mpmodule that allows you to load or update layers to an .aprx project, the problem is when it comes to importing style sheets in an automated way to the project.

Is there a way to import these style sheets into a Project via Python without having to do so from ArcGIS pro?

I'd tried to use aprx.importDocument() method but when I link a stylex file, code breaks with OSError

Code sample and TraceBack:

aprx = arcpy.mp.ArcGISProject("CURRENT")
aprx.importDocument(r"C:\Styles\Burgos.stylx")
Traceback (most recent call last):
File "", line 2, in
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\_mp.py", line 228, in importDocument
return convertArcObjectToPythonObject(self._arc_object.importDocument(*gp_fixargs((document_path, include_layout, reuse_existing_maps), True)))
OSError: C:\Styles\Burgos.stylx

Tags(5)