# Race on workspace startup

**URL:** <https://mworks.discourse.group/t/race-on-workspace-startup/65>\
**Category:** Support\
**Created:** [May 16, 2022, 2:38pm UTC](https://mworks.discourse.group/t/race-on-workspace-startup/65 "2022-05-16T14:38:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [May 16, 2022, 2:38pm UTC](https://mworks.discourse.group/t/race-on-workspace-startup/65/1 "2022-05-16T14:38:12Z")

</div>

Hi Chris,

I’m finding that when I launch a workspace file with MWClient, sometimes it looks like the Python Client Bridge script runs before the MWEL is done loading, and so it doesn’t initialize properly. I think you fixed some race like this before, is that right? I’m using the snapshot from 2021.01.08.

Mark

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [May 16, 2022, 2:56pm UTC](https://mworks.discourse.group/t/race-on-workspace-startup/65/2 "2022-05-16T14:56:08Z")

</div>

Hi Mark,

Yes, when loading a workspace that contains an experiment path, the client doesn’t wait for the experiment to finish loading before launching the Python bridge or any other plugin window. I don’t think this issue has come up before, which is surprising.

I will work on fixing this. In the meantime, you may be able to avoid the issue by adding a short wait at the start of your Python bridge script – maybe a second or two, depending on how long your experiment takes to load.

Sorry about this!

Cheers,  
Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [May 16, 2022, 3:12pm UTC](https://mworks.discourse.group/t/race-on-workspace-startup/65/3 "2022-05-16T15:12:27Z")

</div>

Thanks, Chris!

I have a strong feeling that you and I discussed this before, but perhaps my memory is broken on this. I think I’m overfilling it.

Mark

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [June 13, 2022, 3:39pm UTC](https://mworks.discourse.group/t/race-on-workspace-startup/65/4 "2022-06-13T15:39:30Z")

</div>

Hi Mark,

I’m looking at this now, and I’m having trouble understanding where this is causing problems for you. Can you tell me exactly how the script’s initialization fails? Is it expecting a particular value for a variable and not seeing it?

Thanks,  
Chris

---

<div class="post-metadata">

**Author:** ![histed](https://avatars.discourse-cdn.com/v4/letter/h/5e9695/32.png) [@histed](https://mworks.discourse.group/u/histed)\
**Post date:** [July 27, 2022, 1:44am UTC](https://mworks.discourse.group/t/race-on-workspace-startup/65/6 "2022-07-27T01:44:16Z")

</div>

Hi Chris,

I saw this with the following:  
An experiment that takes longer to load than the Python bridge script takes to register callbacks on variables.  
The error I got looked to be something like ‘variable missing’.

Any chance you can see this if you use an expt that takes a long time to load?

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 29, 2022, 3:09pm UTC](https://mworks.discourse.group/t/race-on-workspace-startup/65/7 "2022-07-29T15:09:11Z")

</div>

Hi Mark,

I still can’t reproduce this. Even if I try to register a callback for a non-existent variable, I never get an error message (which isn’t a great outcome, obviously, but beside the point here).

Can you send me an example experiment and Python script that have produced this issue? I don’t necessarily need to be able to run them. I mainly want to see how you’re setting things up, as there may be relevant details that I’m missing.

Thanks,  
Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [January 31, 2023, 3:03pm UTC](https://mworks.discourse.group/t/race-on-workspace-startup/65/8 "2023-01-31T15:03:50Z")

</div>

Closed on January 31, 2023, 3:03pm UTC


