# Error: Cannot use ‘in’ operator to search for ‘undefined’ in undefined

**URL:** https://discourse.psychopy.org/t/error-cannot-use-in-operator-to-search-for-undefined-in-undefined/28278
**Category:** Coding
**Tags:** pavlovia
**Created:** [March 29, 2022, 11:36am UTC](https://discourse.psychopy.org/t/error-cannot-use-in-operator-to-search-for-undefined-in-undefined/28278 "2022-03-29T11:36:40Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)
#### Post date: [March 29, 2022, 12:12pm UTC](https://discourse.psychopy.org/t/error-cannot-use-in-operator-to-search-for-undefined-in-undefined/28278/2 "2022-03-29T12:12:11Z")

</div>

I think that there are probably issues with the start conditions for your keyboard components.

next\_2

```auto
len(_choose_2_allKeys) > 0

```

\_choose\_2\_allKeys doesn’t exisit and choose\_2.keys is undefined until the first choose\_2 key is pressed.

I don’t know if $(‘g’ in choose\_2.keys) works as a stop condition locally but online I’d expect to need to define a variable in an auto code component and then use that.

You have two keyboard components and event.getKeys in the same routine, which is likely to result in unwanted behaviour.

[Thread continued from [Stuck on initialising the experiment page](https://discourse.psychopy.org/t/stuck-on-initialising-the-experiment-page/28232)]

---

_[View the full topic](https://discourse.psychopy.org/t/error-cannot-use-in-operator-to-search-for-undefined-in-undefined/28278)._
