VWAP reference different than vwap() function
Yes, that is a correct statement. The VWAP chart study is a solution which resets the value of the vwap() function at the start of each period. Stated another way, the VWAP chart study is derived from the vwap() function.
I think the confusion lies in name which has been chosen to select the "period" or "time span" of the VWAP chart study. It does create quite a lot of confusion because they use the name "time frame" for the input parameter which selects the "span of time" used to determine the "periods". At the start of each new "period", the VWAP study resets the value of the vwap() function to the first bar of the new period. For each bar that follows the reset bar, the chart study computes a value using a very complex formula. And within that formula, the actual vwap() function is merely one small component.
So yes, the two sections of code you present in your question basically a comparison of apples and oranges. The two sets of data are completely different. I prepared two screenshots which demonstrated this on the chart. When you see these two data sets plotted on the chart it will help you to understand the massive differences between them.
How does that help you achieve your goal? Well I did not find sufficient details in your question to understand what your goal is.
Reference the first screenshot below: If your goal is the build a scan based on comparing two different "time spans" of the VWAP chart study, then you will find your first section of code is 100% accurate.
Reference the second screenshot below: If your goal is to compare the values of the vwap() function from two different "Aggregation Periods". Well you don't have any solution to do this on Thinkorswim. It's simply not supported.