# Hot Link Python Script

**URL:** https://discourse.slicer.org/t/hot-link-python-script/8261
**Category:** Development
**Created:** [September 2, 2019, 3:04pm UTC](https://discourse.slicer.org/t/hot-link-python-script/8261 "2019-09-02T15:04:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bsmarine](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/bsmarine/32/3898_2.png) [@bsmarine](https://discourse.slicer.org/u/bsmarine)
#### Post date: [September 2, 2019, 3:04pm UTC](https://discourse.slicer.org/t/hot-link-python-script/8261/1 "2019-09-02T15:04:54Z")

</div>

Does anyone know of python script that activates hot-link mode between different windows/studies?

---

<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: [September 2, 2019, 6:58pm UTC](https://discourse.slicer.org/t/hot-link-python-script/8261/2 "2019-09-02T18:58:51Z")

</div>

You’d just need to convert this code to python:

> <https://github.com/Slicer/Slicer/blob/master/Libs/MRML/Widgets/qMRMLSliceControllerWidget.cxx#L2077-L2094>

---

<div class="post-metadata">

### Author: ![JoostJM](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/joostjm/32/1091_2.png) [@JoostJM](https://discourse.slicer.org/u/JoostJM)
#### Post date: [September 3, 2019, 5:30am UTC](https://discourse.slicer.org/t/hot-link-python-script/8261/3 "2019-09-03T05:30:00Z")

</div>

it’ll be something like

```auto
compositeNodes = slicer.util.getNodesByClass('vtkMRMLSliceCompositeNode')
for node in compositeNodes:
  node.SetHotLinkedControl(linked)

```

---

<div class="post-metadata">

### Author: ![bsmarine](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/bsmarine/32/3898_2.png) [@bsmarine](https://discourse.slicer.org/u/bsmarine)
#### Post date: [September 3, 2019, 7:03pm UTC](https://discourse.slicer.org/t/hot-link-python-script/8261/4 "2019-09-03T19:03:15Z")

</div>

Thanks for the help!

This will automatically turn on hot link for all views in Python:

```auto
compositeNodes = slicer.util.getNodesByClass('vtkMRMLSliceCompositeNode')
for node in compositeNodes:
  node.SetHotLinkedControl(1)
  node.SetLinkedControl(1)
```
