import ROOT ROOT.gROOT.ProcessLineSync(".x test.C+") print ROOT.test(1) # prints 3.0 (this line works only in pyROOT and CINT, not in compiled code) tree.Draw("x:test(x)")