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()
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
.