I have 2 file python
1. Main file: video_downloader.py, Sub file; download_script.py
Testing everything working fine but after convert to EXE not working

Below is my code
video_downloader.py

import sys
import subprocess
import os
import urllib.parse
from PyQt5.QtWidgets import (QApplication, QWidget, QVBoxLayout, QPushButton, 
                             QTextEdit, QLabel, QLineEdit, QFileDialog, QMessageBox)
from PyQt5.QtCore import Qt

class VideoDownloaderApp(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        self.setWindowTitle('TikTok Video Downloader')
        self.setGeometry(100, 100, 400, 400)
        self.setStyleSheet("background-color: #e0f7fa;")  # Light blue background

        layout = QVBoxLayout()

        # Title label
        title_label = QLabel('TikTok Video Downloader')
        title_label.setAlignment(Qt.AlignCenter)
        title_label.setStyleSheet("font-size: 24px; font-weight: bold; color: #00796b;")
        layout.addWidget(title_label)

        # Link input area
        self.link_input = QTextEdit(self)
        self.link_input.setPlaceholderText("Enter TikTok Links (one per line) or paths to links.txt files:")
        self.link_input.setStyleSheet("font-size: 12px; border: 1px solid #00796b; border-radius: 5px;")
        layout.addWidget(self.link_input)

        # Save folder input
        self.save_path_input = QLineEdit(self)
        self.save_path_input.setPlaceholderText("Save Folder:")
        self.save_path_input.setStyleSheet("font-size: 12px; border: 1px solid #00796b; border-radius: 5px;")
        layout.addWidget(self.save_path_input)

        # Browse button
        browse_button = QPushButton('Browse', self)
        browse_button.clicked.connect(self.browse_folder)
        browse_button.setStyleSheet("background-color: #00796b; color: white; font-weight: bold; padding: 10px; border-radius: 5px;")
        layout.addWidget(browse_button)

        # Download button
        self.download_button = QPushButton('Download', self)
        self.download_button.clicked.connect(self.start_download)
        self.update_download_button_state()  # Initial state
        layout.addWidget(self.download_button)

        self.link_input.textChanged.connect(self.update_download_button_state)  # Update button state on text change
        self.save_path_input.textChanged.connect(self.update_download_button_state)  # Update button state on save path change

        self.setLayout(layout)

    def browse_folder(self):
        folder = QFileDialog.getExistingDirectory(self, 'Select Save Folder')
        if folder:
            self.save_path_input.setText(folder)

    def start_download(self):
        save_location = self.save_path_input.text()
        links_input = self.link_input.toPlainText().strip()

        if links_input and save_location:
            links = []
            txt_files = []

            for line in links_input.splitlines():
                line = line.strip()
                if line:
                    if line.endswith('.txt'):
                        txt_files.append(line)
                    else:
                        links.append(line)

            # Start console processes for links
            if links:
                self.run_links_download(links, save_location)

            # Start console processes for each .txt file
            for file_path in txt_files:
                self.run_file_download(file_path, save_location)

    def run_links_download(self, links, save_location):
        links_str = ','.join(links)
        command = ['python', 'download_script.py', links_str, save_location]
        subprocess.Popen(command, creationflags=subprocess.CREATE_NEW_CONSOLE)

    def run_file_download(self, file_path, save_location):
        links = self.get_links_from_file(file_path)
        if links:
            links_str = ','.join(links)
            command = ['python', 'download_script.py', links_str, save_location]
            subprocess.Popen(command, creationflags=subprocess.CREATE_NEW_CONSOLE)
        else:
            print(f"No valid links found in {file_path}")

    def get_links_from_file(self, file_path):
        if file_path.startswith("file:///"):
            file_path = urllib.parse.unquote(file_path[8:])

        links = []
        try:
            with open(file_path, 'r') as file:
                links = [link.strip() for link in file.readlines() if link.strip()]
            print(f"Links read from {file_path}: {links}")
        except Exception as e:
            print(f"Error reading links from file: {e}")

        return links

    def update_download_button_state(self):
        links_input = self.link_input.toPlainText().strip()
        save_location = self.save_path_input.text().strip()

        if links_input and save_location:
            self.download_button.setStyleSheet("background-color: #388e3c; color: white; font-weight: bold; padding: 10px; border-radius: 5px;")
        else:
            self.download_button.setStyleSheet("background-color: #a0a0a0; color: white; font-weight: bold; padding: 10px; border-radius: 5px;")

if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = VideoDownloaderApp()
    window.show()
    sys.exit(app.exec_())


download_script.py

import sys
import os
import re
import requests
from PyQt5.QtWidgets import QApplication, QMessageBox

def sanitize_title(title):
    return re.sub(r'[\/:*?"<>|]', '', title)

def download_tiktok_video(link, save_location):
    try:
        print(f"Fetching video details for: {link}")
        api_url = "https://www.tikwm.com/api/"
        params = {"url": link}
        response = requests.get(api_url, params=params)

        if response.status_code == 200:
            data = response.json()
            video_url_hd = data['data'].get('hdplay', data['data']['play'])
            video_title = data['data']['title']
            sanitized_title = sanitize_title(video_title)
            profile_name = data['data']['author']['unique_id']

            profile_folder = os.path.join(save_location, profile_name)
            os.makedirs(profile_folder, exist_ok=True)

            download_with_progress(video_url_hd, sanitized_title, profile_folder)
        else:
            print(f"Failed to fetch video details for {link}: {response.status_code} - {response.text}")

    except Exception as e:
        print(f"An error occurred while downloading the video: {e}")

def download_with_progress(video_url, file_name, save_folder):
    try:
        print(f"Starting download: {file_name}")
        with requests.get(video_url, stream=True) as response:
            response.raise_for_status()

            total_size_in_bytes = int(response.headers.get('content-length', 0))
            block_size = 1024  # 1 Kilobyte

            base_file_name = os.path.join(save_folder, f"{file_name}.mp4")
            file_path = base_file_name
            counter = 1

            while os.path.exists(file_path):
                file_path = os.path.join(save_folder, f"{file_name} {counter}.mp4")
                counter += 1

            with open(file_path, 'wb') as file:
                downloaded_size = 0

                # Initialize the progress update
                print(f"Downloading {file_path} (0.00%)")

                for data in response.iter_content(block_size):
                    downloaded_size += len(data)
                    file.write(data)

                    # Update progress in the console
                    if total_size_in_bytes > 0:
                        progress_percent = (downloaded_size / total_size_in_bytes) * 100
                        print(f"\rDownloading {file_path} ({progress_percent:.2f}%)", end='')

                print(f"\nDownload completed: {file_path}")

    except Exception as e:
        print(f"An error occurred during download: {e}")

def show_download_complete_message():
    # Ensure the QApplication instance exists
    app = QApplication.instance()  # Use the existing QApplication instance
    if app is None:
        app = QApplication(sys.argv)  # Create a new QApplication instance if needed
    msg_box = QMessageBox()
    msg_box.setWindowTitle("Download")  # Set the title of the message box
    msg_box.setText("Download completed!")  # Set the message text
    msg_box.setStandardButtons(QMessageBox.Ok)
    msg_box.exec_()

def main():
    if len(sys.argv) != 3:
        print("Usage: python download_script.py <links_comma_separated> <save_location>")
        return

    links_str = sys.argv[1]
    save_location = sys.argv[2]

    # Split the links from the comma-separated string
    links = links_str.split(',')
    print(f"Links to download: {links}")  # Debugging print

    if not os.path.exists(save_location):
        print(f"Error: Save location '{save_location}' does not exist.")
        return

    # Download each video link
    for link in links:
        print(f"Downloading video from link: {link}")  # Debugging print
        download_tiktok_video(link.strip(), save_location)  # Ensure stripping any whitespace

    # Show message box after all downloads are complete
    show_download_complete_message()
    os.system("title Downloading")
if __name__ == '__main__':
    main()