__all__ = ["coil", "expio", "freesurfer", "hdf5_io", "mesh", "models", "neuron", "optimization", "regression", "roi",
           "subject", "tensor_scaling", "tensor_scaling", "tms_pulse", "util", "visualization"]

from .hdf5_io import *
from .subject import *
from .visualization import *
from .freesurfer import *
from .hdf5_io import *
from .optimization import *
from .roi import *
from .subject import *

try:
    from .pckg import libeep
except (ImportError, SyntaxError):
    pass

_lazy_modules = {
    "coil": "pynibs.coil",
    "expio": "pynibs.expio",
    "mesh": "pynibs.mesh",
    "models": "pynibs.models",
    "neuron": "pynibs.neuron",
    "regression": "pynibs.regression",
    'visualization': "pynibs.visualization",
    "util":"pynibs.util"
}
__version__ = "0.2026.1"

# when pipped, datadir is under pynibs
__testdatadir__ = os.path.join(os.path.dirname(__file__), '..', 'tests', 'data')
__datadir__ = os.path.join(os.path.dirname(__file__), '..', 'data')
if not os.path.exists(__testdatadir__):
    __testdatadir__ = os.path.join(os.path.dirname(__file__), 'tests', 'data')
    __datadir__ = os.path.join(os.path.dirname(__file__), 'data')
if not os.path.exists(__testdatadir__):
    warnings.warn(f"Cannot find pynibs.__testdatadir__='{__testdatadir__}'")


def __getattr__(name):
    if name in _lazy_modules:
        import importlib
        mod = importlib.import_module(_lazy_modules[name])
        globals()[name] = mod  # cache so future accesses skip __getattr__
        return mod
    raise AttributeError(f"module {__name__!r} has no attribute {name}")
