# Load python function without module; custom key binding

**URL:** <https://discourse.slicer.org/t/load-python-function-without-module-custom-key-binding/6421>\
**Category:** Support\
**Created:** [April 6, 2019, 5:26pm UTC](https://discourse.slicer.org/t/load-python-function-without-module-custom-key-binding/6421 "2019-04-06T17:26:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [April 6, 2019, 5:26pm UTC](https://discourse.slicer.org/t/load-python-function-without-module-custom-key-binding/6421/1 "2019-04-06T17:26:48Z")

</div>

I have found the [toggleZoomSync()](https://discourse.slicer.org/t/synchronize-display-scale-across-slice-viewers/4547/5) user function quite useful. It works very well in the Python interactor.

I wish to load it on start without creating a GUI module/extension. And also, create a keyboard shorcut (Meta+Z on Linux) for quick access. I don’t wish any GUI widget to use that function.

I should be able to create a module with the Extension Wizard if it can’t be avoided. I could find no documentation to create a custom key binding however.

Can you please advise ?

Thank you.

---

<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:** [April 6, 2019, 5:29pm UTC](https://discourse.slicer.org/t/load-python-function-without-module-custom-key-binding/6421/2 "2019-04-06T17:29:45Z")

</div>

This example should answer all your questions:

[https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Customize\_keyboard\_shortcuts](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Customize_keyboard_shortcuts)

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [April 6, 2019, 6:38pm UTC](https://discourse.slicer.org/t/load-python-function-without-module-custom-key-binding/6421/3 "2019-04-06T18:38:32Z")

</div>

> [@lassoan](#):
>
> This example should answer all your questions:

Yes, both questions are resolved.

Thank you very much.
