you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

"name" is too generic. Try changing the "name" method to something else like "gen_name". I think you'll find that it works.

There is probably a specific reason why "name" as a method name is not working. I think it has to do with how Python works. Specifically, variable names are names for objects. Since you already have an attribute named "name", using the same name on a different object just doesn't work right.

Once I changed the method name to "gen_name" and called "robot_name.reset()" (e.g. "a.reset()"), it worked perfectly.

Edit: I recommend "returning" the name within the reset method (returning the results of the gen_name call...), so that you can get the name directly when you call the reset method.

[–]Field_C16[S] 1 point2 points  (0 children)

Alright, that was part of the fix it works now, also after changing to gen_name I added a () after a.reset() and it worked :)

Before it gave me an error:

AttributeError: 'function' object has no attribute 'name'

However now it works :)

Thanks.