access assets by their file names?

Lets say Ive loaded an asset like this

loader.loadModel('panda')

Now I want to access the loaded model by it’s filename, not object name in Python. How would you do that? Tags, dictionaries? Or is there a simpler way?

What could be simpler than a dictionary? :slight_smile:

David

I don’t know, thats why I asked :slight_smile:

Do you need access to that specific object (instance) or to the model as it is on the disk?

In first case:

models = {}
filename = "superhero"
models[filename] = loader.loadModel(filename)

In second case, you can simply use another call to loadModel() which will get the model from cache.

model = loader.loadModel("foo")  # slow
second_model = loader.loadModel("foo")  # fast