dingo-gw / dingo

Dingo: Deep inference for gravitational-wave observations
MIT License
55 stars 18 forks source link

`__init__.py` and circular imports #156

Closed stephengreen closed 1 year ago

stephengreen commented 1 year ago

Occasionally imports into __init__.py files (e.g., in dingo.core.utils) result in circular import errors when modules being imported refer to each other via __init__.py. To fix this, for imports within dingo, import submodules directly, i.e., use

from dingo.core.utils.dataset_utils import build_train_and_test_loaders

rather than

from dingo.core.utils import build_train_and_test_loaders

The latter is convenient for external use, but internally it is best to use the full path.