I am created a plugin that creates point features and line features from a SpatiaLite database. The lines must be snapped to a point at least in one end.
Then problem is that the last created point features are not identified by the snap indicator.
They are inside the database, even labels are displayed immediately. I have to close the project to be able to snap on them.
I tried in my code the three following sentences(together) after 'layer.commitChanges()' :
layer.reload()
QgsProject.instance().reloadAllLayers()
layer.setDataSource( layer.source(), layer.name(), layer.providerType() )
But this is not working.
How to I make the snapper recognize the new points?