0

This is my file structure in vscode:

enter image description here

I have some general functions in my "general.py" file. For some reason if I try to

import general

inside any of the files located in "telefone" folder it works fine but, I can't import like this on "rotinas" folder files, inside that folder I need to

sys.path.append(os.path.abspath('settings'))
import general

why is it happening?

I tried creating "__init__.py" files inside my folders, no success.

  • try to name the file w8 __ init __ .py instead of init.py. Note: remove the spaces. – DevManX Jul 22 '23 at 21:12
  • here also a good tutorial for you https://www.webucator.com/article/how-to-create-a-python-package/ – DevManX Jul 22 '23 at 21:14
  • The files are named `__init__.py` the stack overflow interpreted the double underscore as commands... I'll read ur link, thanks! – Milton Ventura Jul 22 '23 at 21:46
  • you should **specify the full file path** if you are using `sts.path.append()`. Whilst it can be done (and i have seen it in production code), it is generally considered to be "bad practice" to fragment a project like this.... – D.L Jul 22 '23 at 22:46

0 Answers0