I'm trying to do simple thing as running plugin that load layers and show loading bar at the same time as the loading process takes awhile. I'm trying to use QGIS task manager with no success..
This is what I did:
if result: task1 = QgsTask.fromFunction( 'waste cpu 1', self.getting_layers,self.completed) task2 = QgsTask.fromFunction( 'waste cpu 1', self.run_status_bar,self.completed) task1.addSubTask(task2) QgsApplication.taskManager().addTask(task1)
I try it in two different tasks as well. When I write the function call as "self.getting_layers()" I get "Assert error". When without it does nothing.
What am I doing wrong?