Jutta
Jutta

Reputation: 553

How to import own packages

This is the structure of my files:

D:\projects
  -projects\bin
    -bin\__init__.py
    -bin\app.py

  -projects\test
    -test\app_test.py

  -projects\__init__.py

I want to use app.py in my app_test files, and I write:

from bin.app import app

But it seems this doesn't work.

How can I organize my files and import my own modules?

Upvotes: 3

Views: 6053

Answers (1)

Juan Chacon
Juan Chacon

Reputation: 122

You will have to create a:

__init__.py 

file in the root directory. This link will explain more of why you need it, and the contents of such file.

Regards,

Upvotes: 0

Related Questions