You can use Logtalk running on SWI-Prolog + JPL to easily accomplish having two encapsulation units (objects instead of modules in this case) sharing a common initial definition (the contents of the file you're trying to load in two or more different modules). For the details of using Logtalk + SWI-Prolog + JPL see for example:
https://github.com/LogtalkDotOrg/logtalk3/wiki/Using-Logtalk-with-JPL
For the code sharing implied in your question, one solution is to put the contents of the file in an object and then derive from it (using inheritance) as many object as needed. For a more specific advice I would need more details on what you're trying to accomplish.