# Stop code execution until Event

**URL:** https://discourse.slicer.org/t/stop-code-execution-until-event/33532
**Category:** Support
**Tags:** python
**Created:** [December 27, 2023, 11:54am UTC](https://discourse.slicer.org/t/stop-code-execution-until-event/33532 "2023-12-27T11:54:52Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [December 27, 2023, 6:30pm UTC](https://discourse.slicer.org/t/stop-code-execution-until-event/33532/2 "2023-12-27T18:30:50Z")

</div>

Hi -

For this issue and probably [your other question](https://discourse.slicer.org/t/extract-ras-coordinates-by-clicking/33531) you could study how the event observers work in Slicer to make everything asynchronous. E.g. [this example](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#get-a-notification-if-a-markup-control-point-position-is-modified) has callbacks for markup interactions. Your code shouldn’t block, but should instead be driven by callbacks when events occur.

---

_[View the full topic](https://discourse.slicer.org/t/stop-code-execution-until-event/33532)._
