user4596: Let's say my smartcontract needs BuiltinData.
Quicksearch in documentation reveals that BuiltinData is in:

Plutus.V1.Ledger.Api
Plutus.V2.Ledger.Api
PlutusTx.Builtins.Internal
PlutusTx
PlutusTx.Builtins
PlutusTx.Prelude
...

How to know which include I should add? Which ones are preferred and why?

user5844: Some of these are reexported versions of others. This means some of them are not necessary. Also PlutusTx.Prelude should be included in all projects as it maps types into PlutusTx which complies with the bytecode that runs on the chain.
This means if your Data type is in PlutusTx.Prelude, you should not need the other modules in general. The exception is if other parts of your code use that module.

4596: <p>Let's say my smartcontract needs <strong>BuiltinData</strong>.
Quicksearch in documentation reveals that <strong>BuiltinData</strong> is in:</p>
<ul>
<li>Plutus.V1.Ledger.Api</li>
<li>Plutus.V2.Ledger.Api</li>
<li>PlutusTx.Builtins.Internal</li>
<li>PlutusTx</li>
<li>PlutusTx.Builtins</li>
<li>PlutusTx.Prelude</li>
<li>...</li>
</ul>
<p>How to know which include I should add? Which ones are preferred and why?</p>
 5844: <p>Some of these are reexported versions of others. This means some of them are not necessary. Also <code>PlutusTx.Prelude</code> should be included in all projects as it maps types into <code>PlutusTx</code> which complies with the bytecode that runs on the chain.</p>
<p>This means if your Data type is in <code>PlutusTx.Prelude</code>, you should not need the other modules in general. The exception is if other parts of your code use that module.</p>
