Cannot delete `from main import *` in unit tests. MAJOR ISSUE

Problem description:
In Unit Tests setup, you cannot delete the from main import *
Why is this an issue?
Because I can’t add a main file (for various reasons I am not going to take the time to explain) and I don’t understand why replit doesn’t allow us to delete that line and choose different imports.
Why does it have to rely on main?
Expected behavior:
You should be able to choose your imports.

Actual behavior:
It won’t let you.

Steps to reproduce:
Make a unit test in a python file, go to setup and try to delete the from main import *

1 Like

Hi! Welcome to the community! I think that python repls must always have a file for reasons I can not explain (then again I’m still not sure). Perhaps a more experienced coder could help you out!

Not being able to delete that line is intended behavior. from main import * imports everything from If you’d like to choose your imports, you can add additional import statements underneath the comment.

If you’re not going to take the time to explain why you want to be able to delete that line and why it’s a “major issue”, we can’t address the situation and hear you out.


I guess if you wanted to change the name of the ‘main’ file where the script execution starts, which you can do using the .replit file, you would also want to change that line. However, a change like that has no real value, it’s just a different name, there isn’t really any reason not to just stick with main.pyother than personal preference.