Calling C++ from Python

(First time poster) Hey, I’m trying to call some C++ code with Python. For Python, I have:

mm = ROOT.MuonMatcher


I created a MuonMatcher class with C++ code with Test() being a method within it (it just returns a number; I just want to see it work. But I get:

AttributeError Traceback (most recent call last)
6 #mm = ROOT.MuonMatcher.MatchOppositelyChargedMuons(rvf, rvi)
----> 7 mm = ROOT.MuonMatcher
9 mm.Test()

/cvmfs/ in _fallback_getattr(self, name)
190 if res:
191 return res
→ 192 raise AttributeError(“Failed to get attribute {} from ROOT”.format(name))
194 def _finalSetup(self):

AttributeError: Failed to get attribute MuonMatcher from ROOT

I was wondering what the deal is. I got this to work once, but never again.
Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Please have a look at:

Is your MuonMatcher class in a library? Then you can use this option: