Question
I am currently having trouble with getting hydra to work when not using @hydra.main
in the main.py
script (refer to error section). I have tried the compose API, but that prevents me from using most of the functionality that hydra provides. I am unsure what I am trying to achieve is possible.
Current Configuration Structure
Project Root
|
├── config
│ ├── default.yaml
│ ├── configuration1.yaml
│ └── configuration2.yaml
└── src
├── utils
│ └── initialise.py
└── main.py
Code
initialise.py
import hydra
import omegaconf
CONFIG = None
@hydra.main(version_base=None, config_path='../../config', config_name='default')
def init_configs(cfg: omegaconf.DictConfig) -> None:
global CONFIG
CONFIG = cfg
# Other initialisation code here.
init_configs()
main.py
from utils import initialise
print(initialise.CONFIG)
Error
Primary config module 'config' not found.
Check that it's correct and contains an __init__.py file