When
test_something
tries to import usingfrom . import script_a
it returns the errorAttempted relative import in non-package
.
Using one dot
.
will lead you to the current directory. You should use two dots..
to get to the parent dir.You cannot run a module with a relative import itself. You can only import it. So
test_something.py
can only run as an import but it is not possible to run the script as__main__