My project is: mymodule.py and test/test.py
In test.py I put: from myfunc import mymodule
but python 3.6 answers:
ModuleNotFoundError: No module named 'titalicapi'
If instead I put (after reading about similar questions):
from ... import mymodule
the answer now is:
ValueError: attempted relative import beyond top-level package
How I can let test.py to work? thanks!
1 Answer 1
could you perhaps show your file path? That'll help a lot.
Sample File Path
mainfolder
|-test.py
|
|-workfiles
|- myfunc
If your current project looks something like this, you can impprt the function and use workfiles.myfunc to access the function
from workfiles.myfunc import myfunc
I would suggest putting your main file in the root folder and sub-files/modules in other sub-folders for easier access! Hope this helped :)
__init__.pyin the module folder?