Hey everyone, I just found out about how to make packages in python and thought it was an absolutely good idea especially with how it can get repetitive typing the same code over and over again.
My setup
base folder
main.py/mypackage
init.py
module1.py
But as I’ve tried to do so in Pythonista it just keeps giving me errors.
I’ve tried it this way
#__init__.py
from module1 import some_function
And this way
#__init__.py
from .module1 import some_function
Excluding and including the period.
As I’ve seen it in many guides of making packages. But I keep getting this message when I try calling it from my main.py .
ModuleNotFoundError: No module named 'main.module1'; 'main' is not a package
I’m sure I’ve completely overlooked the answer somewhere. I’ve been on stackoverflow and seen quite a few posts about explicit relative imports but I can’t make heads or tails of what to do to make a package.
I’d appreciate any help I can get!