# What to pass as 'view' for python\_view.call\_render function?

**URL:** https://discourse.paraview.org/t/what-to-pass-as-view-for-python-view-call-render-function/9784
**Category:** ParaView Support
**Created:** [June 10, 2022, 11:58am UTC](https://discourse.paraview.org/t/what-to-pass-as-view-for-python-view-call-render-function/9784 "2022-06-10T11:58:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![pindakaas](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/p/cab0a1/32.png) [@pindakaas](https://discourse.paraview.org/u/pindakaas)
#### Post date: [June 10, 2022, 11:58am UTC](https://discourse.paraview.org/t/what-to-pass-as-view-for-python-view-call-render-function/9784/1 "2022-06-10T11:58:22Z")

</div>

I’m trying to use a custom render function (call\_render from the python\_view module) for a PythonView instance. If I write a render(view, width, height) function in the Script tab, it works just fine.

Then I tried renaming my render function to render2 and the call\_render call below it.  
For example python\_view.call\_render(render2, view, 300, 300).  
I don’t understand though what exactly should I pass as the view argument? It should be a vtkPythonView class instance, but how can I access it?

I tried something like FindView(“PythonView1”).SMProxy.GetClientSideView(), which technically returns vtkPythonView class, but this approach does not work.

I need this because it seems that multiple PythonView instances will all use the same render function, even if the code in each view’s Script window is completely different. Whichever render function was modified last is the one used to render all PythonViews. Thought that using custom render functions would solve this issue.

---

<div class="post-metadata">

### Author: ![pindakaas](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/p/cab0a1/32.png) [@pindakaas](https://discourse.paraview.org/u/pindakaas)
#### Post date: [June 10, 2022, 12:29pm UTC](https://discourse.paraview.org/t/what-to-pass-as-view-for-python-view-call-render-function/9784/2 "2022-06-10T12:29:50Z")

</div>

Looked at the source code of the vtkPythonView class, and it seems that call\_render is not meant to be used from the PythonView’s Script window.

The code given in Script window is built into a Python module. Then vtkPythonView searches for a render function within this module, and the name of the function is hard-coded to “render”. Afterwards vtkPythonView class calls the python\_view.call\_render function, giving the pointer to itself as the view argument.

Ok. Got it. But why is the render function “shared” between multiple PythonViews in ParaView?

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [June 10, 2022, 5:18pm UTC](https://discourse.paraview.org/t/what-to-pass-as-view-for-python-view-call-render-function/9784/3 "2022-06-10T17:18:06Z")

</div>

Ah, you have uncovered an important bug with this implementation. Each view should have its own environment to prevent this problem.

I reported the problem here: [https://gitlab.kitware.com/paraview/paraview/-/issues/21431](https://gitlab.kitware.com/paraview/paraview/-/issues/21431)
