# transformNode.SetName('some\_string') gives TypeError: 'str' object is not callable

**URL:** <https://discourse.slicer.org/t/transformnode-setname-some-string-gives-typeerror-str-object-is-not-callable/4426>\
**Category:** Support\
**Created:** [October 17, 2018, 8:18am UTC](https://discourse.slicer.org/t/transformnode-setname-some-string-gives-typeerror-str-object-is-not-callable/4426 "2018-10-17T08:18:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brhoom](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/brhoom/32/1228_2.png) [@brhoom](https://discourse.slicer.org/u/brhoom)\
**Post date:** [October 17, 2018, 8:18am UTC](https://discourse.slicer.org/t/transformnode-setname-some-string-gives-typeerror-str-object-is-not-callable/4426/1 "2018-10-17T08:18:07Z")

</div>

Hi,

while getName works, why setName does not work? how can one change the transform node name from script.

```
            >> t =getNode('LinearTransform_1')
            >> t
            (vtkCommonCorePython.vtkMRMLLinearTransformNode)0x7f7686c06188
            >> tname = t.GetName()
            'LinearTransform_1'              
            >>t.SetName(tname)
                Traceback (most recent call last):
                 File &quot;&lt;console&gt;&quot;, line 1, in &lt;module&gt;
                 TypeError: 'str' object is not callable
```

---

<div class="post-metadata">

**Author:** ![brhoom](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/brhoom/32/1228_2.png) [@brhoom](https://discourse.slicer.org/u/brhoom)\
**Post date:** [October 17, 2018, 8:35am UTC](https://discourse.slicer.org/t/transformnode-setname-some-string-gives-typeerror-str-object-is-not-callable/4426/2 "2018-10-17T08:35:35Z")

</div>

The workaround I found is using SubjectHierarchy:

```
   >> shn = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
   >> sii = shn.GetSceneItemID()
   >> t = shn.GetItemChildWithName(sii,'LinearTransform_1')
   >> shn.SetItemName(t, 'NewName')
```

---

<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:** [October 17, 2018, 12:05pm UTC](https://discourse.slicer.org/t/transformnode-setname-some-string-gives-typeerror-str-object-is-not-callable/4426/3 "2018-10-17T12:05:29Z")

</div>

Doublecheck your steps. This works:

```auto
>>> n = getNode('MRH*')
>>> n.GetName()
'MRHead'
>>> n.SetName('hoot')
>>> n.GetName()
'hoot'

```

---

<div class="post-metadata">

**Author:** ![brhoom](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/brhoom/32/1228_2.png) [@brhoom](https://discourse.slicer.org/u/brhoom)\
**Post date:** [October 17, 2018, 12:23pm UTC](https://discourse.slicer.org/t/transformnode-setname-some-string-gives-typeerror-str-object-is-not-callable/4426/4 "2018-10-17T12:23:22Z")

</div>

Thanks for your comment. Yes it works but I had to restart Slicer. It seems there where variable conflicts. in the python interactor
