Best practices around organizing/composing packer scripts to stay DRY?

Are there any features for composing packer scripts? And can packer scripts access each other locally?

If I have scriptA and scriptB is scriptB accessible to scriptA during runtime?

Are there any built-in features for reusable module sort of things I can use in my packer scripts? Like say a function that I can import and use in multiple packer scripts so im not duplicating a lot of boiler kind of code multiple scripts might need to use?