'Lookup name in a namespace spanning sys.modules and __main.dict__'

def get_entity(self, name):

    namespace = sys.modules.copy()
    namespace.update(__main__.__dict__)
    return eval(name, namespace)
