I have feature layers that have a different name in the TOC then that they do in the GDB. I cannot change either of these and I need the name of the feature class from the GDB in order to make my model work. I have tried things such as parse path but I only get the name of the layer as it is in the TOC.
I have tried a few ArcPy/Python methods, but with my little knowledge of these things, I could not figure out how to get the GDB name as an output parameter.
I am using ArcMap version 10.3.1
Below I have added an example of my model and the code I last used to try and get the name.
import os
import arcpy
layer = arcpy.GetParameter(0)
print(os.path.basename(layer))
arcpy.Describe(lyr).name