# Asynchronous block functions

**URL:** <https://community.thunkable.com/t/asynchronous-block-functions/1313620>\
**Category:** Questions about Thunkable X\
**Created:** [May 28, 2021, 3:06pm UTC](https://community.thunkable.com/t/asynchronous-block-functions/1313620 "2021-05-28T15:06:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tommaso](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@Tommaso](https://community.thunkable.com/u/Tommaso)\
**Post date:** [May 28, 2021, 3:06pm UTC](https://community.thunkable.com/t/asynchronous-block-functions/1313620/1 "2021-05-28T15:06:43Z")

</div>

Hi,

How can I prevent a function to start before the previous function has been completed? See example below:

![Capture](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/5/a5fe258b1ea63a33010d4b881e5d5cc373bc9ec2.png)

In this example I have the 1st funtiction which takes around 10 seconds to complete, then the 2nd function takes around 3 seconds, and then there is an alert to help me understand if two lists included in those function are empty or not. As it current stands the alert shows 0 0 almost immediately (and in the meantime the functions continue to work).

What I would like to achieve is as follows:

1. 1st function completed, then
2. 2nd function completed, then
3. Alert shows

Could you please help me understand how can I reach this result? Thank you!

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [May 28, 2021, 4:05pm UTC](https://community.thunkable.com/t/asynchronous-block-functions/1313620/2 "2021-05-28T16:05:40Z")

</div>

That screen shot is reeeaaaallly small. Not sure why but if you can upload it again, we’ll be able to see it better.

Also, we’ll need to see the blocks in those two functions. There’s absolutely no way we can advise you without that. Certain blocks will affect this issue such as Create, Clone, database lookups, etc.

---

<div class="post-metadata">

**Author:** ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)\
**Post date:** [May 28, 2021, 8:33pm UTC](https://community.thunkable.com/t/asynchronous-block-functions/1313620/3 "2021-05-28T20:33:33Z")

</div>

Check out this technique

> [@Wrapping Asynchronous (then do) blocks into a Synchronous Function resolves unpredictable results](https://community.thunkable.com/t/wrapping-asynchronous-then-do-blocks-into-a-synchronous-function-resolves-unpredictable-results/910511):
>
> Thunkable provides an extensive library of calls to external services including Google Docs and Web APIs. These external calls are, by necessity, asynchronous calls. That is, the request is sent to the external serivce, Thunkable block execution continues on it’s merry way, then the external service sends a reply. Thunkable wraps the external calls in in blocks with “Then Do” sections. This is a massive improvement over separate call and response block (MIT App Inventor), but it is not without …

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 1:22pm UTC](https://community.thunkable.com/t/asynchronous-block-functions/1313620/4 "2024-11-08T13:22:13Z")

</div>


