Suppose a certain directory checkerbot (You can download the files). From my current directory, I have this directory called checkerbot which contains 4 files, i.e. base.py, checkers.py, __init__.py and model.py.
In [1]: import checkerbot.checkers as ck
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-d7411e2bfdb5> in <module>
----> 1 import checkerbot.checkers as ck
~/../main/checkerbot/checkers.py in <module>
----> 1 import base
2
3 class Game:
4 # Initializes the class.
5 def __init__(self):
ModuleNotFoundError: No module named 'base'
This error told me I have no base.py in thecheckerbot directory, but it is false. How can I fix that? For your information, I am using python 3.7.6.
UPDATE
In [2]: import .base
File "<ipython-input-2-e4256d58e84b>", line 1
import .base
^
SyntaxError: invalid syntax
Suppose my current directory is main and checkerbot is in main/. If I run ipython and then from . import base then I got :
In [1]: from . import base
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-a8bda1f23f19> in <module>
----> 1 from . import base
ImportError: attempted relative import with no known parent package
Another error :
In [5]: from checkerbot import base
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-5-3203dc774184> in <module>
----> 1 from checkerbot import base
~/../main/checkerbot/base.py in <module>
1 import tensorflow as tf
2 import numpy as np
----> 3 from model import model
4
5 agent = tf.keras.models.Sequential()
ModuleNotFoundError: No module named 'model'