So I am using pyroot to do data analysis. The analysis code chain runs different plugins on the data and outputs them to a root file, storing the output of each plugin in to their own TDirectoryFile within the root file. I wrote a function that takes the name of the root file and the name of the plugin and should return the plugins TDirectoryFile. However it returns instead a NoneType, and then crashes as soon I try to do anything with the object.
from ROOT import *
def getPluginData(fName,pName):
tfile=TFile("Analyzer.root")
plugin= tfile.Get("MuIndNeuSpallPlugin")
#outputs <class 'ROOT.TDirectoryFile'>
print type(MuIndNeuSpallPlugin)
return plugin
#This should be a <class 'ROOTTDirectoryFile'.>, but is a NoneType instead
MuIndNeuSpallPlugin=getPluginData("Analyzer.root","MuIndNeuSpallPlugin")