The TWF rules require certain things in order to make use of them.
First, the initial attack: "When you take the Attack action and attack with a light melee weapon that you're holding in one hand,...."
If your attack meets those requirements then you now have a bonus action, with its own requirements: "...you can use a bonus action to attack with a different light melee weapon you're holding in the other hand."
Let's break these requirements down.
"When you take the (Attack action) and (attack) with a (light) (melee) (weapon) that you're holding (in one hand)"
In order to generate the bonus action, your initial attack must be an attack granted by taking the Attack action, not any old attack, like an OA or from the Cast a Spell action that gives you an attack.
Next, it must actually be an attack, not something else (like a shove).
Next, the object used to execute the attack must be (light). If you have the Dual Wielder feat you can ignore this pre-req.
Next, the object must be a (melee) weapon. Later in the TWF rules, it says that if either weapon has the 'thrown' property then you may throw the weapon instead of making a melee attack, but this doesn't take away the requirement that the attack must be made with a (melee) weapon, so tough luck for dart throwers.
Next, and most crucially for the shield-bash crowd, the initial attack must be made with a (weapon). It must actually be a (weapon), and a (melee weapon) at that, not any old non-weapon object that you can use to bash someone via the Improvised Weapons rule. Shields are not actual (weapons), even when used as a weapon. This is why Crawford didn't answer the "does the +2 AC from the shield stack with the +1 AC from Dual Wielder" question by saying "no, they don't atack", and instead said "Dual Wielder is for melee weapons, not things like shields".
Lastly, the attack must be made by a melee weapon that is held in only (one hand).
You can certainly use one of your attacks to use your shield as an improvised weapon, but this will not generate that bonus TWF attack.
If you have two attacks, you could use one to make a shield bash and the other to attack with a light melee weapon in one hand, and this second attack would generate the bonus TWF attack.
The bonus TWF attack has its own restrictions. If used, it must be used to (attack)(so no shove) with a (different)(so not the same weapon again, even if you swap hands)(light)(melee)(weapon) in the (other hand)(so you can't drop the sword you used to make the first attack and draw another with the same hand and attack with that).
So even if you had two attacks, shield bashed with one attack then attacked with a sword to generate a bonus TWF attack, you could not use your shield to execute that Bonus attack because it is not a (weapon).