Its not immediately clear to me why this is handled differently from graphing modules import? If it can be imported in a common way then this can be a function like import_dependency(classes_dict, imports_dict)