Circular import error

That is what is happening. My understanding this is because of an attempt to separate code in files without looking at variable scopes. This is why I am trying to help understanding why it happens more than fixing the error

Besides a module should never import main … that alone is sign of errors.

2 Likes

yes this is basically the problem im having

so data cant read main unless imported and main cant read data unless import but if i import them both into each other i get circular import error so how do i fix

i feel you are onto something can you please give an example

look at my post above. The example might be silly but it should give you a clue on a way to solve it.
Basically when you take code out form the main and put in module, you need to pass things as function arguments …

Worst comes to worst I can fix you code, but let’s first try to see if you manage alone on basis on some hints as than you will no longer makes the mistake again.

First of all, what is userentry? Even if it was not a circular import, it would not work as it is not defined?

“userentry” is a enter text box that you can type in its for tkinter
Edit: tkinter is for user visuals
as seen here userentry=tk.Entry(window)

Just import tk in compile.py and then create the vars there. Then import compile from main.

@dragonhunter1 that is what most do … this is a major hint already :slight_smile:

1 Like