Beginner here. I am trying to find out what classes some methods are associated with and what those methods do by using the help function for some code im working on as seen below

layer = iface.activeLayer()

I have already used help(iface.activeLayer) and that works But I am having issue when I try help(iface.startEditing) or help(iface.activeLayer.startEditing)

I am really just trying to figure out where the startEditing() method is coming from/ what class it is apart of. Also, is there a python code that returns the class a method is apart of.


2 Answers 2


As far as I know, there is no a method returning the class of a method in Python.

You may want to use Search in QGIS API Documentation (C++ API, Python API). If you type a method name in Search box, you get a list of classes which have the method.

enter image description here

enter image description here

And use help(layer.startEditing) to get help on startEditing. Also use, for example, dir(layer) or dir(QgsVectorLayer) to get what methods and properties layer instance or QgsVectorLayer class have.


Additional to @Kadir Şahbaz: you can use the type() statement:

layer = iface.activeLayer()

which will print: <class 'qgis._core.QgsVectorLayer'>. Since startEditing is a method, you see the class to which this method belongs....hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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