Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

it would be absolutely great if someone could help me with the following problem:

I have a simple Python-Plugin that starts another executable in a subprocess. From within this application (which can't be modified on a large scale) I want to start another python-script that shows some pois in QGIS. But the problem is, that this script doesn't seem to have access to the current QGIS instance (no qgis.utils.iface object).

Is there ay way to remember the QGis-instance object or access it by looking through the currently running processes?

Thanks a lot in advance! Kian

share|improve this question
Can we ask what the other application is? – Nathan W Dec 20 '12 at 12:54
Hi Nathan, it's a test scenario because we want to validate the usage of QGis by some of our products. Since our customers have various GIS in use it makes sense for us not rewrite code to adapt the same app to different GIS. – Kian Dec 20 '12 at 19:28

As I don't know a lot of the details I'm just going of what I know has worked for me in the past. Disclaimer: Might not be the 100% correct way to do it but worked at the time

I don't think talking to QGIS directly will work, if some one knows how I would be happy to know.

What you need to do is build some kind of communication bridge that both applications can talk over. In the past I have used a shared memory approach, as we had limited ability to change the C application we needed to talk to. Python can do quite easily using the mmap.

enter image description here

import mmap
mem = mmap.mmap(0, 1024, 'ToQGISBlock')
while True:

Read up the mmap docs to see better examples

Of course the shared memory thing requires that your application is able to create and read shared blocks of memory (memory mapped files), without knowing your applications language it will be hard to comment on that aspect.

You could also use sockets which like most things in Python are dead easy. I have no experience with sockets so I'm not going to try and give an in depth example.

share|improve this answer
Dear Nathan, thanks so much for the detailed answer! Great great help! I'll try that and in case I succeed I'let you know. – Kian Dec 21 '12 at 13:44 went away too soon: Want to add my best wishes for Christmas :-)) – Kian Dec 21 '12 at 13:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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