how can I load multiple modules in the project wit...
# ask-community
d
how can I load multiple modules in the project with different groups? This is our current Definition:
Copy code
defs = Definitions(
    assets=load_assets_from_modules([training, scoring, lake_tables]),
    resources=resources_by_deployment_name[deployment_name],
)
I'd like each module to have it's own group label, but when I try to split it up, I can't seem to get the assets to be the correct type
s
We don't currently have an easy way to do this, but I agree it could be useful to add one. Would you be up for filing a github issue that we can use to track this request?
d
Absolutely!
I actually found a workaround for this using
load_assets_from_package_module
and having each module in it's folder as a package module (I'm not 100% sure that's correct, I'm very new to Python). Would this still be worth filing an issue for?
s
interesting - does your workaround involve calling
load_assets_from_package_module
on each module?
d
yes, and specifiying the group name on each module. I followed the fully_featured example
Copy code
from . import distributed_scoring, lake_tables, scoring, training

lake_assets = load_assets_from_package_module(
    package_module=lake_tables, group_name="lake_tables"
)
dist_scoring_assets = load_assets_from_package_module(
    package_module=distributed_scoring, group_name="distributed_scoring"
)
training_assets = load_assets_from_package_module(
    package_module=training, group_name="training_model"
)
scoring_assets = load_assets_from_package_module(
    package_module=scoring, group_name="single_scoring"
)
s
got it - up to you on the Github issue! if you think the APIs would be better with the change, then that's a useful datapoint for us
375 Views