'bool' object has no attribute 'my function'

Hi guys, I met the Error: ‘bool’ object has no attribute ‘my function’ and I fixed when I run code inside Maya script edit but still no clue why still show error when I run it through PyCharm.

The interesting thing is use same code but not use self (because there’re error when you use it) in Maya script edit, the code works.

However, when I use same code but run it in PyCharm the classical error occurred!

I test my code sever times no issue, but it shows the error when I try build UI use cmds.button(label=my_label, command=(armR.buildLArmJoints)) # call a founction inside other function

I’m wondering, Are some setting I didn’t do it right or some class didn’t import successfully?

thank you read my topic, I hope can get some help.

Stick a print(armR.BuildLArmJoints) above the line that’s the problem: it will probably print out True or False when it should say that it’s a function.

No, it get a answer: function myclass.buildLArmJoints at location
That just can know what is the function and where is located.
The problem is buildLArmJoints function can or not call other function inside founction buildLArmJoints .
The error shows founction buildLArmJoints can’t call other function inside the function because it can’t take *args by some reason I don’t know.

Oh, that’s it. All button callback functions get passed a boolean argument by default as their first argument (I think it’s for “was this a right click” but I’m not sure) . Just add an argument to armR.BuildLArmJoints and ignore it.

   def BuildLArmJoints(_):
         # do stuff, ignoring the argument '_'

I have *args, it doesn’t work.
def buildLArmJoints(self, *args)

I find this’s import issue, and it’s weird, Maya don’t identify ‘self’ key words when use UI.

Thank your replying.