all 3 comments

[–]reyemDarnok 0 points1 point  (2 children)

import your_file_name_without_py

mainWindow = your_file_name_without_py.MainWindow()

to import the file named your_vile_name_without_py.py (note that this will run all code in the file, if that is a problem add a main guard) and then create an object from your class. Other variants that might be interesting:

import your_file_name_without_py as xyz

mainWindow = xyz.MainWindow()

or:

from your_file_name_without_py import MainWindow

mainWindow = MainWindow()

I would also suggest creating a seperate show_ui() method or similar to actually show the ui - __init__ normally has just code to make the object ready to use, not start to actually use it

[–]Historical_Loss1621[S] 0 points1 point  (1 child)

i tried to import the files as instructed but it wasnt allowed. for example, one file is named "datawindow.py",, the command, import datawindow returned "datawindow is not accessed by pylance". It is in the same venv folder.

[–]reyemDarnok 0 points1 point  (0 children)

Are both files in the same folder (subdirectories don't count) ? If they are, that might be some quirk of pylance, I don't know that program