Issue with calling a class from another module

Basically I have a working class that if run by itself works just fine, but when called from another module some parts of the code don’t work, while not really critical a problem I have no idea why and I want to know // tried many chatgpt solutions no work.

As you can see in the picture there are two instances of calculator, one run from the parent module and one run from another. What could be causing this issue? Entire code below.

Ignore below if TLDR because I honestly don’t know what the problem is else I would snippet:

import threading
import time
import pdb
from tkinter import *
from tkinter import filedialog
from tkinter import ttk
from tkinter import Toplevel
import tkinter as tk
from playsound import playsound
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import pygame

class Calculator:
def init(self):

    self.root = Tk()
    self.root.withdraw()

    self.SONG_PATH = "C:/Users/Claire/Desktop/bells.mp3"
    self.results_history = []
    self.result_value = StringVar()

    self.dark_background = "#1c1c1c"
    self.dark_fg = "#ffffff"
    self.dark_btn_background = "#2b2b2b"
    self.dark_btn_fg = "#ffffff"
    self.magenta_red = "#EC2783"

    # Define colors for light theme
    self.light_background = "#ffffff"
    self.light_fg = "#000000"
    self.light_btn_background = "#f0f0f0"
    self.light_btn_fg = "#000000"

    # Create style for light theme
    self.light_style = ttk.Style()
    # Create style for dark theme
    self.dark_style = ttk.Style()

    # Initialize Pygame mixer
    pygame.mixer.init()
    # Create a window
    self.window = tk.Toplevel(self.root)
    self.window.title("Calc")
    self.window.iconbitmap("C:/Users/Claire/Desktop/weed.ico")

    self.fig = plt.figure()
    self.canvas = FigureCanvasTkAgg(self.fig, master=self.window)

    #pygame.mixer.init()
    self.sound = pygame.mixer.Sound("C:/Users/Claire/Desktop/bells.mp3")

def play_audio(self, volume=0.05):
        pygame.mixer.init()
        # Set the volume of the sound
        self.sound.set_volume(volume)
        # Play the sound file
        self.sound.play()

    # Define functions for each operation
def add(self):
    result = float(self.entry1.get()) + float(self.entry2.get())
    self.label_result.config(text="Result = " + str(result))
    self.results_history.append((self.entry1.get(), '+', self.entry2.get(), result))
    self.update_history()
    self.update_graph()

def subtract(self):
    result = float(self.entry1.get()) - float(self.entry2.get())
    self.label_result.config(text="Result = " + str(result))
    self.results_history.append((self.entry1.get(), '-', self.entry2.get(), result))
    self.update_history()
    self.update_graph()

def multiply(self):
        result = float(self.entry1.get()) * float(self.entry2.get())
        self.label_result.config(text="Result = " + str(result))
        self.results_history.append((self.entry1.get(), '*', self.entry2.get(), result))
        self.update_history()
        self.update_graph()

def divide(self):
        result = float(self.entry1.get()) / float(self.entry2.get())
        self.label_result.config(text="Result = " + str(result))
        self.results_history.append((self.entry1.get(), '/', self.entry2.get(), result))
        self.update_history()
        self.update_graph()

def power(self):
        result = float(self.entry1.get()) ** float(self.entry2.get())
        self.label_result.config(text="Result = " + str(result))
        self.results_history.append((self.entry1.get(), '^', self.entry2.get(), result))
        self.update_history()
        self.update_graph()

def dark_theme(self):
        self.window.config(background=self.dark_background)
        self.window.style = self.dark_style
        self.dark_style.configure("TButton", background="#EC2783", foreground="#EC2783")
        self.dark_style.configure("TEntry", background="#EC2783", foreground="#EC2783")
        self.dark_style.configure("TLabel", background=self.dark_btn_background, foreground="#EC2783")
        self.dark_button.configure(style="TButton")
        self.label_instruction.configure(style="TLabel")
        self.label_result.configure(style="TLabel")
        self.entry1.configure(style="TEntry")
        self.entry2.configure(style="TEntry")
        self.fig.set_facecolor(self.dark_background)
        self.fig.patch.set_alpha(0.7)

def light_theme(self):
        self.window.config(background=self.light_background)
        self.dark_style.configure("TButton", background=self.light_btn_background, foreground=self.light_btn_fg)
        self.dark_style.configure("TLabel", background=self.light_background, foreground=self.light_fg)
        self.dark_style.configure("TEntry", background=self.light_background, foreground=self.light_fg)
        self.dark_button.configure(style="TButton")
        self.label_instruction.configure(style="TLabel")
        self.label_result.configure(style="TLabel")
        self.entry1.configure(style="TEntry")
        self.entry2.configure(style="TEntry")
        self.fig.set_facecolor(self.light_background)
        self.fig.patch.set_alpha(0.7)

def update_history(self):
        # Clear the listbox
        self.history_listbox.delete(0, END)

        # Repopulate the listbox with the updated data
        for item in self.results_history:
            self.history_listbox.insert(END, str(item[0]) + ' ' + str(item[1]) + ' ' + str(item[2]) + ' = ' + str(
                item[3]))

def update_graph(self):
        self.fig.clf()  # Clear the plot
        x = []
        y = []
        for item in self.results_history:
            x.append(float(item[0]))
            y.append(float(item[2]))
        plt.plot(x, y)
        plt.xlabel('Input 1')
        plt.ylabel('Input 2')
        plt.title('Result vs Inputs')
        self.canvas.draw()  # update the figure canvas

def show_history(self):
        history_window = Toplevel(self.window)
        history_window.title("History")
        history_window.geometry("300x300")

        scrollbar = Scrollbar(history_window)
        scrollbar.pack(side=RIGHT, fill=tk.Y)

        self.history_listbox = Listbox(history_window, yscrollcommand=scrollbar.set)
        self.history_listbox.pack(side=LEFT, fill=tk.BOTH)

        scrollbar.config(command=self.history_listbox.yview)

        self.update_history()

def graph(self):
        # Create a new window for the graph
        graph_window = tk.Toplevel(self.window)
        graph_window.title("Graph")

        # Create a Figure object and add a subplot
        fig = plt.Figure()
        ax = fig.add_subplot(111)

        # Generate data for the plot
        x = []
        y = []
        for item in self.results_history:
            x.append(float(item[0]))
            y.append(float(item[2]))

        # Plot the data on the subplot
        ax.plot(x, y)
        ax.set_xlabel('Input 1')
        ax.set_ylabel('Input 2')
        ax.set_title('Inputs vs Result')

        # Create a canvas for the plot and add it to the graph window
        self.canvas = FigureCanvasTkAgg(fig, master=graph_window)
        self.canvas.draw()
        self.canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)

def create_widgets(self):

    # Create entry widgets for input numbers
    self.entry1 = ttk.Entry(self.window)
    self.entry2 = ttk.Entry(self.window)

    # Create label widgets for instructions and result
    self.label_instruction = ttk.Label(self.window, text="Enter two numbers:")
    self.label_result = ttk.Label(self.window)

    # Create button widgets for each operation
    self.button_history = ttk.Button(self.window, text="History",
                                    command=lambda: (threading.Thread(target=self.play_audio).start(), self.show_history()))
    self.button_add = ttk.Button(self.window, text="plus", command=self.add)
    self.button_subtract = ttk.Button(self.window, text="minus", command=self.subtract)
    self.button_multiply = ttk.Button(self.window, text="multiply", command=self.multiply)
    self.button_divide = ttk.Button(self.window, text="divide", command=self.divide)
    self.button_power = ttk.Button(self.window, text="power", command=self.power)
    self.light_button = ttk.Button(self.window, text="Light Theme",
                                  command=lambda: (threading.Thread(target=self.play_audio).start(), self.light_theme()))
    self.dark_button = ttk.Button(self.window, text="Dark Theme",
                                 command=lambda: (threading.Thread(target=self.play_audio).start(), self.dark_theme()))
    self.button_graph = ttk.Button(self.window, text="Graph",
                                   command=lambda: (threading.Thread(target=self.play_audio).start(), self.graph()))

        # Arrange widgets on a grid
    self.button_power.grid(row=3, column=0)
    self.label_instruction.grid(row=0, column=0, columnspan=4)
    self.entry1.grid(row=1, column=0, columnspan=2)
    self.entry2.grid(row=1, column=2, columnspan=2)
    self.button_add.grid(row=2, column=0)
    self.button_subtract.grid(row=2, column=1)
    self.button_multiply.grid(row=2, column=2)
    self.button_divide.grid(row=2, column=3)
    self.label_result.grid(row=3, column=0, columnspan=4)
    self.light_button.grid(row=4, column=0)
    self.dark_button.grid(row=4, column=1)
    self.button_history.grid(row=4, column=2)
    self.button_graph.grid(row=4, column=3)

    # canvas.get_tk_widget().grid(row=7, column=0, columnspan=4)

def run(self):
        self.create_widgets()
        print("Starting main loop...")
        # Start the main loop
        self.window.mainloop()

if name == ‘main’:
frog = Calculator()
frog.run()

import threading
import time
import pdb
from tkinter import filedialog
from tkinter import ttk
import tkinter as tk
from tkinter import Toplevel
from playsound import playsound
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import pygame
from PIL import Image, ImageTk
from Calculator import Calculator

class Omega:
def init(self):
self.root = tk.Tk()
self.root.title(“Main Menu”)
self.root.iconbitmap(“C:/Users/Claire/Desktop/weed.ico”)

    # Create a menu bar
    self.menu_bar = tk.Menu(self.root)

    # Create a file menu
    self.file_menu = tk.Menu(self.menu_bar, tearoff=0)
    self.file_menu.add_command(label="Exit", command=self.root.quit)

    # Create a calculator menu
    self.calculator_menu = tk.Menu(self.menu_bar, tearoff=0)
    self.calculator_menu.add_command(label="Launch Calculator", command=self.launch_calculator)

    # Add menus to the menu bar
    self.menu_bar.add_cascade(label="File", menu=self.file_menu)
    self.menu_bar.add_cascade(label="Calculator", menu=self.calculator_menu)

    self.root.config(menu=self.menu_bar)

    # Load image file
    self.image = Image.open("C:/Users/Claire/Desktop/weedangel2.png")
    self.image_tk = ImageTk.PhotoImage(self.image)

    # Create label widget to display image
    self.image_label = tk.Label(self.root, image=self.image_tk)
    self.image_label.place(x=0, y=0, relwidth=1, relheight=1)

    # Bind window resize event to a function that resizes the image
    self.root.bind("<Configure>", self.resize_image)

def resize_image(self, event):
    # Resize the image to fit the window while maintaining its quality
    width, height = event.width, event.height
    resized_image = self.image.resize((width, height), resample=Image.LANCZOS)

    # If the image is larger than the window, downsample it to improve sharpness
    if width < self.image.width or height < self.image.height:
        resized_image = resized_image.resize((width, height), resample=Image.BICUBIC)

    # Update the label with the resized image
    self.image_tk = ImageTk.PhotoImage(resized_image)
    self.image_label.config(image=self.image_tk)

def launch_calculator(self):
    # Create an instance of the Calculator class and run it
    calculator = Calculator()
    calculator.run()


def run(self):
    self.root.mainloop()

if name == ‘main’:
main_menu = Omega()
main_menu.run()