3

How can I run the graphic modeler from the python console in QGIS?

1
  • 2
    Do you want to run a model from the graphic modeller from the python console, or just make the graphic model editor open up?
    – Spacedman
    Oct 16, 2018 at 6:54

2 Answers 2

4
  • If you want how to run your own model with its parameters, first, open and run the model by Processing Toolbox. Then open Processing > History window and the last process shows how you can run the model. Select it and copy/paste into Python Console.

enter image description here

  • If you want to open Graphical Modeler window by Python Console, try this:

      from processing.modeler.ModelerDialog import ModelerDialog
      dialog = ModelerDialog()
      dialog.show()
    
2
  • I tried to follow your instructions, but my models do not show up in the processing history. Other algorithms (e.g. native:...) do show up. Do you happen to know a reason for this?
    – Vali
    Sep 23, 2020 at 9:05
  • I have no idea. My model appears in processing history after running the model. It may be a bug. Sep 23, 2020 at 9:12
2

If you enter:

import processing
processing.alglist()

In your python console you'll get a list of all available algorithms, and the appropriate syntax to call them. Models are just a kind of algorithms and you can run them with:

processing.runalg('modeler:modeler_name', arg1, arg2 ...)
1
  • Is there an easy way to add a new algorithm to the list of the algorithm? May 28, 2019 at 11:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.