Skip to content Skip to sidebar Skip to footer

Modulenotfounderror: No Module Named '...' [python]

I have only written stand alone script before in Python. Now I am trying to write an app which can transform and migrate data between two databases. But when I am trying to create

Solution 1:

Here's the full code including the __init__.py

File - db/__init__.py

from .DataSource import *
from .RecordSet import * 

File - main/__init__.py

from .main import *

File - PQF/__init__.py

from .db import *
from .main import *
from db import DataSource as database
from db import RecordSet

defmain():
   print("hello")

Run the main.py script as python3 -m main.main

Solution 2:

What you need to do is put main.py hand over your other scripts.

Project
     - PQF
        - db
            -__init__.py
            - DataSource.py
            - RecordSet.py
        - main.py
        -__init__.py

In your main.py, you now make your imports

Post a Comment for "Modulenotfounderror: No Module Named '...' [python]"