I'm using QGIS 2.14.0. I have a custom python script that shows a form and then creates some layers from supplied parameters, but I want to save them on running/closing the form, but cannot figure it out (not default parameters, but persistent data from the last dialog).

I saw another kind of similar question and it said in settings/options tick 'reuse last entered attribute values', but this does nothing. I've a feeling it only works for built in forms.

this is the start of my code, can anyone offer a solution to this?


from qgis.core import *
from qgis.gui import *
from qgis.utils import *
import processing
import os

If the solution is to somehow read/write data to a form I can do this but don't know where to start. I just figured this feature was pretty much a pre-requisite for most forms so has a simple solution.


Not sure if you can control the parameters that way as they are immediately created when the script is read. You could set default values so that they are shown to the user when the script is executed:

##NameArea=string PlaceName
##ShowBoundary=boolean True

If you want to keep the interface open, go to:

Processing > Options > General > Keep dialog open after running an algorithm

And enable this option. That way when you run your script, the interface will remain and the parameters should retain the values previously selected.

| improve this answer | |
  • Yes, I can do that, but I'd like to have it for clicking it again after running it and closing the form. I was thinking there was maybe a pre and post run hook and I could run sql to save/get data from a table into the parameters? – Neil Walker Nov 6 '18 at 11:23
  • @NeilWalker - Sorry but I'm unsure how this could be achieved. Hopefully others can provide an answer ^^ – Joseph Nov 6 '18 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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