# VTKPythonAlgorithmBase object in Python shell

**URL:** https://discourse.paraview.org/t/vtkpythonalgorithmbase-object-in-python-shell/12439
**Category:** ParaView Support
**Tags:** python, vtk
**Created:** [July 3, 2023, 8:13am UTC](https://discourse.paraview.org/t/vtkpythonalgorithmbase-object-in-python-shell/12439 "2023-07-03T08:13:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![atismer](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/da6949/32.png) [@atismer](https://discourse.paraview.org/u/atismer)
#### Post date: [July 3, 2023, 8:13am UTC](https://discourse.paraview.org/t/vtkpythonalgorithmbase-object-in-python-shell/12439/1 "2023-07-03T08:13:21Z")

</div>

I created a VTKPythonAlgorithmBase source for ParaView. Within the constructor the return object `_mp` of `createMachine()` is stored as attribute.

```auto
@smproxy.source( name="dtOOReaderName", label="dtOOReaderLabel" )
class dtOOReader(VTKPythonAlgorithmBase):
  def __init__ (self):
    VTKPythonAlgorithmBase. __init__ (self,
      nInputPorts=0,
      nOutputPorts=1,
      outputType='vtkPolyData'
    )
    self.mp_ = createMachine()
    [...]

```

Is there any way to get a reference to my source class within the Python shell of ParaView? I would like to have access to my attribute `mp_` within the shell. I already figured out that I can access the sources like this:

```auto
>>> from paraview.simple import *
>>> type(GetSources()[('dtOOReaderLabel1', '9414')])
<class 'paraview.servermanager.dtOOReaderLabel'>

```

But this object is not my original one. I guess this is kind of a proxy.

Thanks in advance.  
Alex

---

<div class="post-metadata">

### Author: ![nicolas.vuaille](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nicolas.vuaille/32/5873_2.png) [@nicolas.vuaille](https://discourse.paraview.org/u/nicolas.vuaille)
#### Post date: [July 4, 2023, 7:08am UTC](https://discourse.paraview.org/t/vtkpythonalgorithmbase-object-in-python-shell/12439/2 "2023-07-04T07:08:09Z")

</div>

Indeed, ParaView do not manipulate the algorithm classes directly but only proxies.

The correct way is to create some property to access the information you want. Some documentation here: [5. Programmable Filter — ParaView Documentation 5.11.0 documentation](https://docs.paraview.org/en/latest/ReferenceManual/pythonProgrammableFilter.html#python-algorithm)

---

<div class="post-metadata">

### Author: ![atismer](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/da6949/32.png) [@atismer](https://discourse.paraview.org/u/atismer)
#### Post date: [July 4, 2023, 9:03am UTC](https://discourse.paraview.org/t/vtkpythonalgorithmbase-object-in-python-shell/12439/3 "2023-07-04T09:03:43Z")

</div>

Hi Nicolas,

thank you very much for the answer. What a pity that it does not work.

> The correct way is to create some property to access the information you want.

To be sure that I understand you correct: You do **not** mean that I should store `id(self)` (the id of my object) within a property and access it?

For me as a temporary workaround, I can access the original class by a static class attribute:

```auto
class dtOOReader(VTKPythonAlgorithmBase):
  SELF = None
  def __init__ (self):
    [...]
    dtOOReader.SELF = self
    [...]

```

I know this is a “crowbar solution”.

Thanks,  
Alex
