VSCode threading module

I am trying to use threads in my VSCode program for a seprate function to charge my catapult. Currently, I am not even using the thereading modual but when I run the program, the brain gives me this error:
image
Line six is:
image
Does the Vex Robotics extension not allow the threading modual or is it a diffrent issue.

It does not use threading. see this. (just don’t try and copy the example directly, it needs revising)

https://api.vex.com/iq2/home/python/Thread.html

1 Like

Thanks! Does the Vex Robotics extension block the threading modual?

you have to realize that really the only modules you can use need to be part of the Python VM that runs on the brain. threading is not built into the VM so cannot be used, threading is very implementation specific, we use the Thread class that matches the vex::thread class we have in C++.

1 Like

does the brain have enough processing power to run two threads simunaltainously?

I’m not sure why we would have a Thread class if it didn’t.

With reference to VEXcode blocks.

“When started” hats run as a thread.
All event handlers, “when button pressed” etc. run as threads.

IIRC IQ generation 2 can handle a maximum of perhaps 20 threads.

2 Likes

Good point. Thanks for answering all my questions! Have a nice rest of your day!