# How to use function in module

**URL:** <https://discourse.slicer.org/t/how-to-use-function-in-module/31081>\
**Category:** Development\
**Tags:** extensions\
**Created:** [August 10, 2023, 8:31am UTC](https://discourse.slicer.org/t/how-to-use-function-in-module/31081 "2023-08-10T08:31:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Theo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/theo/32/67129_2.png) [@Theo](https://discourse.slicer.org/u/Theo)\
**Post date:** [August 10, 2023, 8:31am UTC](https://discourse.slicer.org/t/how-to-use-function-in-module/31081/1 "2023-08-10T08:31:15Z")

</div>

i want to use a protected function in “openigtlinkif” module named “startCurrentIGTLConnector(bool)”,so i changed the source code to set it public and compile successfully, but my project still can’t find it, how to let this function open to my project,thanks

 ![1691651824599](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/0/c01ac3a2dc3d677366f828695ea277c4ab5ad862.png)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 10, 2023, 8:41am UTC](https://discourse.slicer.org/t/how-to-use-function-in-module/31081/2 "2023-08-10T08:41:14Z")

</div>

There is no need to change anything in the module’s code. You can add a `vtkMRMLIGTLConnectorNode` to the scene, set its type, port, hostname (if client), and call its `Start()` method:

```python
connectorNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLIGTLConnectorNode")
connectorNode.SetTypeClient('localhost', 18944)
connectorNode.Start()

```

---

<div class="post-metadata">

**Author:** ![Theo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/theo/32/67129_2.png) [@Theo](https://discourse.slicer.org/u/Theo)\
**Post date:** [August 11, 2023, 1:33am UTC](https://discourse.slicer.org/t/how-to-use-function-in-module/31081/3 "2023-08-11T01:33:50Z")

</div>

Thanks for your prompt reply, it works
