Adding statments to while loop through Python

Hello guys hope you are having a great day. I am trying to learn python programing for visual components
and got stuck on something. hope you can help me it seems pretty silly and simple to me to fix but I just can’t figure it out.

I am trying to use the addStatement method to add some robot statements inside a while loop.

now my problem is I cannot get it to add the statement into the while loops scope.

this is how I am trying to do it.

I have a print statement near the end and the output from that reads <vcScope object at 0x00…>
which means that statement does have a vcScope object which in turn should have a addStatement method

but when I try the line statement.addStatement(xxxxxx) i get the error

NameError: Attribute or method ‘addStatement’ not found.

which makes no sense to me since the vcObject should have an “addStatement” method

I’m sure someone with experience knows immediately what I did wrong since this seems like pretty basic python programming so far.

thanks

Carlos Plazas

Solved!!

I figured out the issue thanks to visual components Scott Walter
turns out it was just a typo
it should be
statement.Scope

instead of
statement.Scopes

I changed that and it worked fine mods can delete this thread or leave it up for reference although I don’t think many people will run into this issue

Hy,

Regards
Feature

1 Like

exactly Thanks for illustrating it hopefully it will help new comers like me in the future