diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py index 54ba4bac32e..7fa444d2e86 100644 --- a/lib/spack/spack/package_base.py +++ b/lib/spack/spack/package_base.py @@ -14,7 +14,6 @@ import functools import glob import hashlib -import importlib import io import os import re @@ -818,12 +817,12 @@ def package_dir(cls): @classproperty def module(cls): - """Module object (not just the name) that this package is defined in. + """Module instance that this package class is defined in. We use this to add variables to package modules. This makes install() methods easier to write (e.g., can call configure()) """ - return importlib.import_module(cls.__module__) + return sys.modules[cls.__module__] @classproperty def namespace(cls):