From Dev.to
Fix 'attempted relative import with no known parent package' for good
TL;DR ImportError: attempted relative import with no known parent package means Python ran your file as a script, so it has no package to resolve from .x import y against. The fix: cd to the directory...
