Q:

function within a class returning global name not defined

A function created within a class works when called directly but it does not work with called within the same class. Gives me global name not defined.
I looked at other posts and then I checked my brackets, spacing, etc. but unable to see the issue. 
In the below code this works:
test1 = srtqualifier(mdlname,datatype,dataconvention,t1)
print (test1.spartSABR())

But this doesn't work:
print(test1.makequalifier()) ##NameError: global name 'spartSABR' is not defined

Main Code:
import string

datatype = "Swaption SABR Normal Volatility"
dataconvention = "USD-SIFMA Municipal Swap Index-1W-SWAPTION-PHYSICAL-SEMI-BOND"
mdlname = "IR_SABR"
t1 = 'should-send-back-none'
#datatype = raw_input("Please input Data Type: ")
#dataconvention = raw_input("Please input Data Convention: ")
#modelname = raw_input("Please provide model name: ")

class srtqualifier:
def __init__(self,mdlname,datatype, dataconvention,t1):
    self.mdlname = mdlname
    self.datatype = datatype
    self.dataconvention = dataconvention
    self.t1 = t1
    self.tempholder =  self.dataconvention.split("-")
    self.currency = self.tempholder[0]

    def spartSABR(self):
        secondpartsp = self.tempholder[1].split(" ")
        secondpartsp.append(self.tempholder[2])
        separator = "_"
        secondpart = separator.join(secondpartsp)
        secondpart = secondpart.upper()
        return secondpart

    def modelname(self):
        mdname = {'IR_SABR':'SABR','FX_LN':'FXLN','IR_LGM':'LGM','IR_LMM':'LMM','IR_SABR_FX_LN_GC':'SABR_FX_LN_GC','IR_SABR_GC':'SABR_GC','INFLATION_SABR':'SABR_IF'}
        return mdname.get(self.mdlname)

    def dttype(self):
        dtype = {'Swaption SABR Normal Volatility':'ATM_NORMAL_VOLATILITY','Swaption SABR Rho':'RHO','Swaption SABR Nu':'NU',
                'Swaption SABR Beta':'BETA','Swaption SABR Par Yield Correlation Adjustment':'PAR_YIELD_CORRELATION',
                'Swaption SABR Par Yield Convexity Adjustment':'PAR_YIELD_CONVEXITY','OU MEAN REVERSION':'OU_MEAN_REVERSION',
                 'Libor Market Model Displaced Diffusion Coefficient':'DISPLACED_DIFFUSION_COEFFICIENT',
                 'Indices Spread CapFloorlet Correlation':'INDICES_SPREAD_CAPFLOORLET_CORRELATION',
                 'Indices Spread CapFloorlet Correlation by Strike Minus ATM':'INDICES_SPREAD_CAPFLOORLET_CORRELATION_BY_STRIKE_MINUS_ATM',
                 'Indices Spread CapFloorlet Correlation by Strike':'INDICES_SPREAD_CAPFLOORLET_CORRELATION_BY_STRIKE',
                 'Quanto Swaption GC Correlation':'QUANTO_SWAPTION_GC_CORRELATION',
                 'Inflation SABR Beta Ratio':'INFLATION_SABR_BETA_RATIO','Inflation SABR IR Corr':'INFLATION_SABR_IR_CORRELATION',
                 'Inflation SABR Nu Ratio':'INFLATION_SABR_NU_RATIO','Inflation SABR Nu ZC':'INFALTION_SABR_NU_ZC',
                 'Inflation SABR Rho Ratio':'INFLATION_SABR_RHO_RATIO','Inflation SABR Rho ZC':'INFLATION_SABR_RHO_ZC',
                 'Inflation SABR Vol ATM Ratio':'INFLATION_SABR_VOL_ATM_RATIO','Inflation SABR Vol ATM ZC':'INFLATION_SABR_VOL_ATM_ZC',
                 'CapFloorlet Linear Exponential Parameter beta':'BETA','Indices Spread CapFloorlet Correlation Term Structure':'INDICIED_SPREAD_CAPFLOORLET_CORRELATION_TERM_STRUCTURE',
                 'OU Correlation':'OU_CORRELATION'}
        return dtype.get(self.datatype)

    def lastpart(self):
        td = self.t1.split("-")
        if any("PHYSICAL" in s for s in td):
            return 'PHYSICALLY_CLEARED'
        elif any("SEMI_ACT365F" in s for s in td):
            return 'SEMI_ACT365F'
        elif any("ANNUAL_BOND" in s for s in td):
            return 'ANNUAL_BOND'
        elif any("CAPLOORLET" in s for s in td):
            return 'CAPLOORLET'

    def makequalifier(self):
        qualifier = string.join([self.currency,"|",spartSABR(),"|",modelname(self.mdlname),"|",dttype(self.datatype),"|",lastpart(self.dataconvention)])
        return qualifier

test1 = srtqualifier(mdlname,datatype,dataconvention,t1)
print (test1.spartSABR())
print(test1.makequalifier())

A:

@Patrick Haugh spotted your bug. See Difference between methods and functions, in Python compared to C++ for an explanation. The linked answer is helpful if you are coming to Python from another language.

