Constant in a namespace not usable in PyROOT since ROOT6

I have a class library that depends on an external header that defines some constants in a namespace. Something like this:

namespace ns {
static const double d = 1.2345;

I was able to make ns.d available in python by adding to the LinkDef.h for my class library:

#pragma link C++ namespace ns;

So with ROOT5, I could open python, import my class library, and then access ns.d as a numerical variable. However, with ROOT6, if I do something like “10.*ns.d” in python, I get the error

TypeError: unsupported operand type(s) for *: ‘ROOT.PropertyProxy’ and ‘float’

How do I get python to let me do numerical calculations with ns.d?


presently, this kind of functionality is not yet implemented. What could be done in this case is to directly include the header file containing the namespace. So, in code:

>>> ROOT.gInterpreter.ProcessLine('#include "myHeader.h"')
>>> ROOT.ns.d