Get component key dynamically by file key or any other way

I think I already answered this question in this thread?