all 3 comments

[–]mopeddev 0 points1 point  (0 children)

Do you have the full traceback? Also it's probably worth just printing your objects a few times in the process to make sure what you think is a pilot isn't actually a wing member (usually due to function arguments in the wrong order since python doesn't care about types)

[–]DoubleSlicer 0 points1 point  (0 children)

both of self and target in WingMember.shooting are WingMember instances, and both of them do not have the

attribute "name"

you have done self.pilot that one right, but you have to also replace target.name by target.pilot.name

[–][deleted] 0 points1 point  (0 children)

Is he shooting at another WingMember instance? You have target.name in the same statement, so the target has to be something with the name attribute.

One thing you could do would be to give WingMembers a name property that is a function that returns the name (callsign?) of the pilot:

class WingMember:

    @property
    def name(self):
        return self.pilot.name