I've downloaded the select within plugin to select features inside polygons objects. I've imported the plugin using import SelectWithin as sw in the console but QGIS does not suggest any of its methods to use.

How can I apply this plugin to my script using PyQGIS and is it possible to use the functions of this plugin in the script?

1 Answer 1


You can show Select Within window using this script:

from SelectWithin.select_within import SelectWithin

# 1st SelectWithin is plugin name, 2nd select_within is module/file name,
# 3rd SelectWithin is class name within the select_within.py file

sw = SelectWithin(iface)

enter image description here

Also, you can use count_vertices, create_centroids, centroid_point, dissolve_feats methods with varible sw, but cannot run processes which OK button does, without displaying Select Within window. Because many of processes are called in run method, and that method always displays the window.

If you want to use all functionality of the plugin, you need to change the contents of select_within.py file (especially run method).

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.