I have a python file (in [user]\.qgis2\python) with some functions that I'm working on. It's just a .py file with a bunch of def function_1, def function_2 etc. in it. On startup I import the .py file with all the functions from my_functions.py import * and then play around with them. at this stage I'm still getting lots of errors, so I go back to my python file in a text editor, make some changes and save the file.

How do I get these changes to be reflected within QGIS? I've tried re-importing the .py file but I get the same errors that I've just corrected, so the only way I've been able to use the modified functions is by restarting QGIS and then importing again.

1 Answer 1


When I wanted to re-import the startup.py file after I made some edits, I used:

import imp, startup
# Use last 3 lines to reload script after saving edits
from startup import *

This saved me the trouble of having to restart QGIS.

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.