2

Trying to understand how to properly use another module when its nested within a folder. I tried implementing a package using the __init__.py as documented in the Packages section of Modules. I am not finding much success. Here is the file structure.

File Structure

For example, I want to be able to reference a class contained within credentials.py in propeller.py. Another use case, I want to reference a function from within base.py in propeller.py. Looking forward to hearing how other approach this. Thanks!

1

1 Answer 1

0

It depends. Is the main module 'the_machine' in your Module Search Path? If so, you should be able to import the_machine.credentials. Otherwise, either add it to your sys.path or import it directly using the path..

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.