Now let's say the ID of the gun in DM is XX000055. The XX is representative of where the file is loaded. In this case, DM is loaded second, giving the prefix of 01, so the ID will be 01000055.
If they added the gun into HH, it would take the same ID of XX000055 (Probably not however) and given the load position of HH would get the prefix of 02, making the ID of the gun 02000055.
As you can see, their ID are different and as such CAN NOT be referenced between one another. The game would consider the gun in HH as a 100% completely different item then the one in DM regardless of how identical their mesh or stats are.
As i said. IT IS IMPOSSIBLE TO MAKE THE AUTOMATIC RIFLE INCLUDED IN THE PERK. Modders are on the receiving end so they can create such a patch to make the gun covered in the perk, but Obsidian can not do to havint to make DLCs independent.
For those who are wondering, the part in bold is where the idea fails.
Each item, upon creation, generates a unique RefID that is used for all calls for that particular item, regardless of source, so having a duplicate of the BAR in HH's files would result in two different items called BAR rather than two copies of the same item. As such, even if load order didn't matter (and it very much does) you still couldn't add the BAR that specifically 'belongs' to DM to the perk from HH.
I ran into a similar issue in FO3 when I was doing an overhaul of the armor system: there were multiple references to certain types of armor across the DLCs, but each one was a unique entity and as such had to be treated individually for the changes to take place as I wanted them to.
Since there is no guarantee that any given person will have more than one DLC, the developers have to treat them as separate entities, which results in the scenario
@Echonite laid out and I highlighted part of above. Because this is the case, perks in one DLC will
never directly reference items from another.
We modders do not have that restriction, as we can work with all extant DLCs at once since we're going to get them anyway, but we
do post warnings in our mod descriptions if it requires additional assets so that perspective users do not download something that requires items they do not have.
There is one perk that
does work across DLCs: Heavyweight. Now, the function of this perk seems to be hard-coded so I haven't seen exactly what it does, but what it
apparently does is poll weapon weights and then cuts them in half if they are 10 or higher. It takes -WGT mods into account so there's more to it than just a simple number poll, but you get the basic idea. Since it does not care where the weights come from it will work on all qualifying weapons regardless of source, whereas almost all other perks are very specific in what they cover and as such are sensitive to what they are trying to check against.