Qlikview execution is always from left to right tabs. Hidden scripts will be in previous to it, considered as 1st.
So, connection should be specified first to load tables where they are from.
And there is always only one connection to data source is possible, it gets disconnected when you specify disconnect command (or) when connected to new source, this way you can connect to one more new data source.
recommended: get connection to data source,load all required tables from it then, you may connect to one more new datasource.