I'm having some issues running scripts, connecting to my TWS account via API

I have a live and a demo account

For example Workshop 4 tutorial

It runs and produces a chart. Presumably from a local data-set. It does not connect to TWS.

The script TradeTest successfully connects to TWS and runs.

How do I specifically have other scripts call or connect to TWS to use data from that source?

Thanks.