getDefinitionByName("Sprite")

Is there a way to call getDefinitionByName() on classes another than those in library?
This approach gives error
ReferenceError: Error #1065: Variable SomeVariableClass is not defined.