Extract consts used in deeply nested modules up to root namespace