Reduce Categorical Values
Recently practitioners are representing categorical variables as embeddings for  ML models. I can see a solution to your problem there.
As your problem is having a two-level hierarchy you can consider two embeddings, one set of embeddings for modules, and another set for files. For every document, you can take their combination and pass it as input to the model. In this way, both the module and file-level information will be captured.
References:
https://towardsdatascience.com/deep-embeddings-for-categorical-variables-cat2vec-b05c8ab63ac0