# python custom render pass

**URL:** https://discourse.vtk.org/t/python-custom-render-pass/5743
**Category:** Support
**Created:** [May 8, 2021, 2:42pm UTC](https://discourse.vtk.org/t/python-custom-render-pass/5743 "2021-05-08T14:42:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![devmessias](https://discourse.vtk.org/user_avatar/discourse.vtk.org/devmessias/32/3364_2.png) [@devmessias](https://discourse.vtk.org/u/devmessias)
#### Post date: [May 8, 2021, 2:42pm UTC](https://discourse.vtk.org/t/python-custom-render-pass/5743/1 "2021-05-08T14:42:51Z")

</div>

Hi, I’m trying to create a custom render pass using just python. It seems that it’s impossible create a subclass in python using vtkRenderDelegate

```python
class myPass(vtk.vtkRendererDelegate):
    # def __init__ (self, *args, **kwargs):
    # super(). __init__ (*args, **kwargs)
    def Render(self, s):
        """
        s: vtkRenderState
        """
        pass
myPass()
# TypeError: this is an abstract class and cannot be instantiated

```

I think it’s the same issue explained here [http://vtk.1045678.n5.nabble.com/vtkParametricFunction-sub-classes-in-Python-td5740029.html](http://vtk.1045678.n5.nabble.com/vtkParametricFunction-sub-classes-in-Python-td5740029.html)

In addition, as explained here  
[https://gitlab.kitware.com/vtk/vtk/blob/master/Wrapping/Python/README.md](https://gitlab.kitware.com/vtk/vtk/blob/master/Wrapping/Python/README.md)

> It is possible to subclass a VTK class from within Python, but it  
> is NOT possible to properly override the virtual methods of the class.

Therefore, there is no reason to peform the following approach

```python
class myPass(vtk.vtkGaussianBlurPass):
....
  def Render( renderState):
     pass

```

Is there any way to create a custom render pass in python?

Thanks

---

<div class="post-metadata">

### Author: ![joaomlap](https://discourse.vtk.org/user_avatar/discourse.vtk.org/joaomlap/32/3201_2.png) [@joaomlap](https://discourse.vtk.org/u/joaomlap)
#### Post date: [January 30, 2025, 10:56am UTC](https://discourse.vtk.org/t/python-custom-render-pass/5743/2 "2025-01-30T10:56:46Z")

</div>

is this still not possible?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [April 1, 2025, 3:04am UTC](https://discourse.vtk.org/t/python-custom-render-pass/5743/3 "2025-04-01T03:04:58Z")

</div>

There may be several solutions, but a simple one is to create a `vtkScriptedRenderPass` in C++ and in all the methods that you want to implement in Python, add a little code snippet that calls a Python object’s corresponding method. We use this approach in 3D Slicer for several classes that we want our users to be able to implement in Python. You can see an example [here](https://github.com/Slicer/Slicer/blob/main/Libs/MRML/DisplayableManager/vtkMRMLScriptedDisplayableManager.cxx). In Python, all you need to do is to create a `vtkScriptedRenderPass` object and set your Python render pass implementation’s .py file in the `SetPythonSource` method.
