I somehow struggle with a seemingly really simple problem regarding importing a class from a module. I have the following file-structure:
program.py
package/
__init__.py
someClass.py
module.py
Those are the contents of each file:
###program.py###
from package import SomeClass
c=SomeClass()
print(c.a)
_________________
###package/__init__.py###
from .someClass import SomeClass
__________________
###package/someClass.py###
import module as m
class SomeClass:
def __init__(self):
self.a=m.add(1,1)
_______________
###package/module.py###
def add(a,b):
return(a+b)
Running this code gives me the error ModuleNotFoundError: No module named 'module'
at the line import module as m
. I know, that I probably need some kind of dot notation at some point. But I cannot figure out, where and how. Thanks for the help.
Simon