0

In my company we decided to structure own python modules using this convention:

dsc.<package_name>

It works without any problem when two modules is used in other project that doesn't follow this convention. However, when in a develop environment I try to develop a new module "dsc.new_module" that references to other, for example, "dsc.other_module", the import raises a not module found exception. Is there any way to solve this?

If I package the module and install, everything is correct but not when I'm developing the module that is not able to find it. The only way I overcome this problem is doing that:

try:
    from dsc.other_module import send_message
except ImportError:
    def dummy(a, b):
        pass
    send_message = dummy

Beacause the function is not essential.

1 Answer 1

1

What you can do is install your packages in development mode. pip install -e . (from the parent folder) After this the imports should work as you envision them, so the same as other packages that use them.

Development mode is not required, but it adds the benefit of implementing changes made to your code immediately.

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

1 Comment

Thank you very much.

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.