I've created a Python script to do some automatic processing within QGIS. The script was stored on the company server and anyone who wanted to use it went to 'add script from file,' did the processing and went about their day.

Fast-forward 6 months and I've now been asked to make some updates to the script. The problem is that 'add script from file' has made local copies of the script on the users' C:/ drive. If I update the script on the server, all the users would need to reload the script. The problem is that I have no idea who actually uses this script. Obviously, I can send a company wide email and get all users to update their script; however this solution seems less than optimal.

My question is: how can I create a sort of re-direct script that the user calls from within QGIS that in turn calls the script stored on server that I can edit? I've looked into import imp but it seems to skip the input parameters given in the server script, throwing a variable undefined error. I am therefore thinking that this issue is a QGIS specific problem, rather than a generic question on script wrapping.

  • It would certainly be possible to write a wapper script rhat fetches the most recent build via copy or HTTP, but it couldn't retroactively distribute itself. Techniques to replace existing scripts would be more appropriate on Stack Overflow proper or Server Fault
    – Vince
    Nov 27, 2017 at 11:11
  • A QGIS solution could be, that you write it as a plugin like the refFunction plugin does and set up a local repository from which you update. This ofc still does not solve the communication problem
    – LaughU
    Nov 27, 2017 at 12:20

1 Answer 1


The method I typically use for distributing plugins within an organization is:

  1. Keep plugin script that is on the users computer as simplistic as possible
  2. Store plugin related python script/files (the business logic) on a server directory that is accessible to all users
  3. In plugin script make system path append to the server directory that has the scripts located, see example below
  4. Make updates to the server script ("serverScriptName"), this way updates are implemented for all users without having to send out an update notification.

import sys 
import serverScriptName

For your situation as @Vince noted you cannot retroactively distribute a feature like this without logic already being in place to update automatically (without some manual update process).

  • Thanks for your answer @artwork21. Do you use Qt to create the input parameters GUI? What I'm really looking for is a way to store the input parameters (in ## format) on the server script, but get them to display when called from the local script. Nov 28, 2017 at 11:21
  • Yes, I use Qt. After you create the plugin using the plugin builder "plugin" it will create a .ui file. The .ui file can be opened in Qt. It is totally doable to make a call from the plugin python file to a server python file and load default values from the server python file to the local Qt form controls.
    – artwork21
    Nov 28, 2017 at 13:33

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