Libraries, I just could not get working.
But, modules. That I could do. I didn't think of it at first, because I thought of a module as being a display piece, as in it would be the header part of the app or something, but I really just needed inputs and outputs. In the end, I ended up having the module be a sidebar, that way I could enforce the selection options that were being provided as inputs, so I'm not sure if it would work for pure code encapsulation without the visual components. But, for me, it provides a way to write code once and use it twice, and that's what I need.