I am getting a warning on the line below stating that: ‘str’ object is not callable.
Is there anything I can do to make the warning go away?
Thanks
Action.action()
Here is the block of code:
Action = DefineAction()
Action.action()
class DefineAction:
def action(self):
self.action = listAction[generateRandomNumber(0,4)]
return self.action
Here is listAction:
listAction =['walks','runs','jaunts','ambles','dashes','sprints']
This is actually more complicated than I initially thought, since you have a function named
self.actionand a variable namedself.action, so your code is confusing. The first time you callDefineAction.action(), you overwrite the function with a string, so the second time you call it, you get this error.Just give your function and variable different names and it should work fine.