I do not have much experience with Asyncio, but it may be an issue on the library’s side or the settings for it.
here is an example of what happens.
from vexcode import * def main(test): test.move() class test: def move(): drivetrain.drive(FORWARD) class test2: def move(): brain.print('test2') def x(): i = test() main(i) def y(): i = test2() main(i) vr_thread(x()) vr_thread(y())
When I try this, it raises this error
Traceback (most recent call last): line 7 async async def move(): ^ SyntaxError: Invalid syntax
There seem to be a lot of things that trigger this, for me, it happens most often when using multiple threads, although also happens with only 1 thread.
I have not found a method to prevent it, but sometimes a slight change to the line stop it, other times it gets 3 asyncs instead of 2.
this may be an error with how I’m trying to use it, but it doesn’t only happen with multiple threads.
It doesn’t seem like this involves threading at all. I was testing it, and it appears to be a preprocessing thing.
This also only happens if the two def main(): lines in the classes are the exact same, so if you have args
class test: def move(x, y): drivetrain.drive(FORWARD) class test2: def move(x, y): brain.print('test2')
this would not work, but the next does
class test: def move(X, Y): drivetrain.drive(FORWARD) class test2: def move(x, y): brain.print('test2')
now I have the issue of the main function adding addition args to the function call…
this is an issue to look out for, but I was able to figure it out mostly.
What seems to cause it is having 2 Identical
def lines, as long as you avoid that it doesn’t seem to be much of an issue.