# Kotlin Create Cancellation Scope

**URL:** <https://community.temporal.io/t/kotlin-create-cancellation-scope/6114>\
**Category:** Community Support\
**Tags:** java-sdk, general-impl, kotlin\
**Created:** [October 1, 2022, 5:40pm UTC](https://community.temporal.io/t/kotlin-create-cancellation-scope/6114 "2022-10-01T17:40:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maikdrop](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@maikdrop](https://community.temporal.io/u/maikdrop)\
**Post date:** [October 1, 2022, 5:40pm UTC](https://community.temporal.io/t/kotlin-create-cancellation-scope/6114/1 "2022-10-01T17:40:47Z")

</div>

Hi guys,

Maybe a stupid question, I try to create a cancellation scope in Kotlin and I cannot ged rid of the error:

> Overload resolution ambiguity. All these functions match.  
> public open fun newCancellationScope(proc: Functions.Proc1\<CancellationScope!\>!): CancellationScope! defined in io.temporal.workflow.Workflow  
> public open fun newCancellationScope(runnable: Runnable!): CancellationScope! defined in io.temporal.workflow.Workflow\> Blockquote

So, how can I create a CancellationScope in Kotlin? Do you have any examples how to create it?

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [October 1, 2022, 10:00pm UTC](https://community.temporal.io/t/kotlin-create-cancellation-scope/6114/2 "2022-10-01T22:00:27Z")

</div>

You could create a Runnable and pass it as param to Workflow.newCancellationScope, for example:

```auto
val runnable = Runnable {
  Async.function(activity::execActivity)
  // ...
}

val c = Workflow.newCancellationScope(runnable)
c.run()
// ...

```

---

<div class="post-metadata">

**Author:** ![maikdrop](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@maikdrop](https://community.temporal.io/u/maikdrop)\
**Post date:** [October 2, 2022, 3:35pm UTC](https://community.temporal.io/t/kotlin-create-cancellation-scope/6114/3 "2022-10-02T15:35:39Z")

</div>

thank you!
