Solved by alpha_omega_alpha in post #2 
              
              
                I would suggest using Python’s str.split() (Reference): 
filename = "abc_def_ghi"
def = str.split(filename, "_")[1]