the issue that you encounter is that the assignment to g_fitn is creating a new reference that scopes out the one in your library. Compare ordinary python:[code] >>> class A:
… fitn = 0
…
b = A.fitn
print b
0
b = 5
print A.fitn
0
[/code]
Likewise, you’ll need to scope your g_fitn, by accessing it where it’s coming from: the global ROOT namespace. That is, with your snippet of code in myLib.cpp, do the following:[code] >>> import ROOT
Note that you can mix “from ROOT import *” and “import ROOT”. For example, to access the function directly (w/o ROOT.), and to scope global variables properly, as they would otherwise be masked like any other python reference.