How to control sequence of execution of customtkinter program

The attached customtkinter program jumps to the end print statements before any selection from the comboboxes. How can I control the program execution so the user selects the baudrate and port from the comboboxes and then the tk.IntVar and tk.String.Var are updated to be used in another section of the program that will connect to a serial port with the baudrate and port tk.variables
also how do I get the 4 space indent on the code below so others won’t need to correct it thanks

type here#
#
import os
import os.path
import sys
import time
import tkinter as tk
import tkinter.ttk as ttk
from ast import literal_eval
from tkinter import *
# from tkinter import CENTER, constants
from tkinter import messagebox, ttk
import threading
import customtkinter 
import serial
import serial.tools.list_ports
import tkinter
import glob

customtkinter.set_appearance_mode('dark')
customtkinter.set_default_color_theme("blue")
#lock = threading.Lock()


def baud_rate():
    #global b_rates
    b_rates = ("9600", "19200", "38400", "57600", "115200")
    #print('baud rate list is ',b_rates)
    return b_rates

def serial_ports():
    """ thanks to the original function writer don't remember
        where it's from many months ago
    """
    if sys.platform.startswith('win'):
        ports = ['COM%s' % (i + 1) for i in range(256)]
    elif sys.platform.startswith('linux') or sys.platform.startswith('cygwin'):
        # this excludes your current terminal "/dev/tty"
        ports = glob.glob('/dev/tty[A-Za-z]*')
    elif sys.platform.startswith('darwin'):
        ports = glob.glob('/dev/tty.*')
    else:
        raise EnvironmentError('Unsupported platform')

    result = []
    for port in ports:
        try:
            s = serial.Serial(port)
            s.close()
            result.append(port)
        except (OSError, serial.SerialException):
            pass
    return result

def update_baud():
    while baud_set == None:
        baud_val_set = baud_combobox.get()
        baud_set.set(baud_val_set)
        print('baud_set = ',baud_set)
        
def update_port():
    while port_set == None:
        port_val_set = port_combobox.get()
        port_set.set(port_val_set)
        print('port_set = ',port_set)
    
  
app = customtkinter.CTk()

port_str_in = tk.StringVar()
port_str_in = serial_ports()

baud_str_in = tk.StringVar()
baud_str_in = baud_rate()

baud_set = tk.IntVar(app)
port_set = tk.StringVar(app)

def port_sel(*args):
    global port_set
    port_sel_val = port_combobox.get()
    port_set = port_sel_val
    print('Port value is ',port_combobox.get())
    #print(port_set)
    #return  port_sel_val
    return  port_set 
 
def baud_sel(*args):
    global baud_set
    baud_set = 0
    baud_sel_val = baud_combobox.get()
    s_sel_baud = int(baud_sel_val)
    baud_set = s_sel_baud
    print('Int value of baudrate is ',baud_combobox.get())
    #print(baud_set)
    #return s_sel_baud
    return  baud_set

update_baud()
update_port()

frame = customtkinter.CTkFrame(master=app,
                               width=350,
                               height=350,
                               corner_radius=10)
frame.pack(padx=20, pady=10)

baud_combobox = customtkinter.CTkComboBox(master=frame,
                                          values=(baud_str_in),
                                          command=baud_sel)

baud_combobox.place(relx=0.25, rely=0.2, anchor=CENTER)

port_combobox = customtkinter.CTkComboBox(master=frame,
                                          values=(port_str_in),
                                          command=port_sel)

port_combobox.place(relx=0.7, rely=0.4, anchor=CENTER)



baud = update_baud()
com = update_port()

print('baud value ',baud)
print('com value ',com)


app.mainloop()


Tried threads, threads with locking, multi-threading. I could have done those wrong. I was expecting a String variable for the port and a int variable for the baudrate to be passed to a serial port connect function.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật