Skip to main content
1 of 2
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404

I don't fully understand what you are trying to do but try this:

lyr = QgsVectorLayer("PATH", 'ligne', 'ogr')
QgsProject.instance().addMapLayer(lyr)

sym = QgsLineSymbol.createSimple({'line_style':'dash','color':'red'})
lyr.renderer().setSymbol(sym)
lyr.triggerRepaint()

line_style and color are case-sensitive. Don't use Line_style and Color.

enter image description here

Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404