# Buggy code
def __call__(self, require):
    try:
        python_require = self._cached_requires[require]
    except KeyError:
        r = ConanFileReference.loads(require)
        requirement = Requirement(r)
        self._range_resolver.resolve(
            requirement, "python_require", update=False, remote_name=None
        )
        r = requirement.conan_reference
        result = self._proxy.get_recipe(
            r, False, False, remote_name=None, recorder=ActionRecorder()
        )
        path, _, _, reference = result
        try:
            dirname = os.path.dirname(path)
            sys.path.append(dirname)
            # replace avoid warnings in Py2 with dots
            module = imp.load_source(str(r).replace(".", "*"), path)
        finally:
            sys.path.pop()
        python_require = PythonRequire(reference, module)
        self._cached_requires[require] = python_require
    self._requires.append(python_require)
    return python_require.module


# Traceback (KeyError)
ERROR: Unable to load conanfile in module2/V2.0/conanfile.py
KeyError: 'module1/1.0@user/channel'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "Python3/lib/site-packages/conans/client/loader.py", line 235, in _parse_file
loaded = imp.load_source(filename, conan_file_path)
File "Python3/lib/imp.py", line 172, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "module2/V2.0/conanfile.py", line 3, in <module>
module1 = python_requires("module1/1.0@user/channel")
File "Python3/lib/site-packages/conans/client/graph/python_requires.py", line 41, in __call__
module = imp.load_source(str(r).replace(".", "*"), path)
File "Python3/lib/imp.py", line 172, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File ".conan/data/module1/1.0/user/channel/export/conanfile.py", line 3, in <module>
class Module1(ConanFile):
File ".conan/data/module1/1.0/user/channel/export/conanfile.py", line 5, in Module1
version = base.helper.getVersion()
AttributeError: module 'helper' has no attribute 'getVersion'

# Fixed code
def __call__(self, require):
    try:
        python_require = self._cached_requires[require]
    except KeyError:
        r = ConanFileReference.loads(require)
        requirement = Requirement(r)
        self._range_resolver.resolve(
            requirement, "python_require", update=False, remote_name=None
        )
        r = requirement.conan_reference
        result = self._proxy.get_recipe(
            r, False, False, remote_name=None, recorder=ActionRecorder()
        )
        path, _, _, reference = result
        module, _ = parse_conanfile(path)
        python_require = PythonRequire(reference, module)
        self._cached_requires[require] = python_require
    self._requires.append(python_require)
    return python_require.module