But I’d advise to never rely on method name checks (aka magic strings). It’s an anti-pattern, i.e. design that can lead to issues down the road. It’s better to make sure all weapons inherit from a base class that has “set_inactive” method (or “deactivate”) and then specific weapons override that method to just do nothing if they don’t support deactivation.
Impossible to answer without knowing what you’re trying to do, exactly. Why is it important to know if set_inactive exists? What’s this method supposed to do? Like what is actually happening in the app, and where does this code even live that checks for a method on each weapon?
Context is needed to provide any answers specific to your situation.