You may encounter the ImportError: attempted relative import with no known parent package error when attempting to use a relative import statement in a module that is not part of a package. To import modules from within a package, dots are used to specify the relative position of the module to be imported, which is done through relative imports.
To resolve this error, ensure that your module is part of a package. A package is a directory that contains one or more Python modules, and it is identified by the presence of a file in the directory called init.py. If your module is not part of a package, you can make one by creating a directory with an init.py file and putting your module in it.
After you’ve created a package, you can import modules from within it using relative import statements. For instance, if you have a module named “mymodule” inside a package named “mypackage,” you can import it with the following statement:
from .mymodule import *
This statement tells Python to import all symbols from the “mymodule” module located in the same directory as the current module.
I hope this helps you to fix the error you are encountering..