What is the best way to locate a function from the bpy module in Blender's source code? I've downloaded the source code and I'm aware you can also browse through it online.

As an example, I would like to inspect bpy.ops.render.render().


2 Answers 2


Get the idname like:

# 'RENDER_OT_render'

(or simply take render.render and replace the . by _OT_)

Search that operator in the source code, and find it here:


/* contextual render, using current scene, view3d? */
void RENDER_OT_render(wmOperatorType *ot)
    PropertyRNA *prop;

    /* identifiers */
    ot->name = "Render";
    ot->description = "Render active scene";
    ot->idname = "RENDER_OT_render";

    /* api callbacks */
    ot->invoke = screen_render_invoke;
    ot->modal = screen_render_modal;
    ot->cancel = screen_render_cancel;
    ot->exec = screen_render_exec;

You'll likely wanna look for the exec function code (screen_render_exec) and see what it does.


Python offers a module for live inspection. If the function is a python function located in a .py file, you can use these functions.

For example,

import bpy
import inspect

#get sourcefile of a panel


(for the difference between .getfile and .getsourcefile see this post on stackoverflow)

  • $\begingroup$ Why does inspect.getfile(bpy.ops.render.render) not work? I get a TypeError error saying it is not a module, class, method, function, traceback, frame, or code object. $\endgroup$
    – Garrett
    Feb 9, 2014 at 22:42
  • 1
    $\begingroup$ pink vertex's example shows inspect.getfile() using a bpy.types class. So the proper call for an operator is inspect.getfile(getattr(bpy.types, bpy.ops.render.render.idname())), which will raise a TypeError: <RNA_Types object at 0x0000000003A875A0> is a built-in class. You need search it in the C code (see my answer where to find it). $\endgroup$
    – CodeManX
    Feb 9, 2014 at 22:55

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.