# How to access vtkRenderer from CLI

**URL:** <https://discourse.slicer.org/t/how-to-access-vtkrenderer-from-cli/269>\
**Category:** Development\
**Created:** [May 4, 2017, 9:51pm UTC](https://discourse.slicer.org/t/how-to-access-vtkrenderer-from-cli/269 "2017-05-04T21:51:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanC](https://avatars.discourse-cdn.com/v4/letter/d/77aa72/32.png) [@DanC](https://discourse.slicer.org/u/DanC)\
**Post date:** [May 4, 2017, 9:51pm UTC](https://discourse.slicer.org/t/how-to-access-vtkrenderer-from-cli/269/1 "2017-05-04T21:51:57Z")

</div>

Hi all.  
I would like to update the renderer as the vtk poly data changes(vtkPolyDataWriter) within a CLI loop.  
Is there a way to force the renderer to re-render?  
It seems that it would be possible from a python script, but not a CLI module?

Thanks!

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [May 4, 2017, 10:13pm UTC](https://discourse.slicer.org/t/how-to-access-vtkrenderer-from-cli/269/2 "2017-05-04T22:13:19Z")

</div>

> [@DanC](#):
>
> It seems that it would be possible from a python script, but not a CLI module?

Right - a CLI is meant to be able to run independent of Slicer (just using command line arguments) so it doesn’t know about renderers or the rest of the GUI.

Sometimes a reasonable approach is to write the inner loop in the CLI and then call it repeatedly from a scripted module that triggers the redraws.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [May 4, 2017, 10:17pm UTC](https://discourse.slicer.org/t/how-to-access-vtkrenderer-from-cli/269/3 "2017-05-04T22:17:07Z")

</div>

> [@pieper](#):
>
> call it repeatedly from a scripted module that triggers the redraws.

Worth noting that by unchecking the option `Prefer CLI executable` in `Settings -> Modules`, the CLI will be called as a function pointer and overhead of writing input and output to disk is removed.
