Python sys.path import module

ubuntu 20.04
python 3.8
docker 20.10.9

MODULE_DIR = os.path.abspath(
    os.path.join(app.config["THIRDPARTY_DIR"], "MODULE")
)
sys.path.extend([MODULE_DIR])
from module import Module

i’m get error:
ModuleNotFoundError: No module named 'module'

without docker all works fine

Without knowing the real name of the module I can only suppose you need to install a module which was already installed on your host.

it doesn’t have to be installed, it is imported this way

Then try to debug the value of sys.path after you added your custom module dir. Print the paths if it contains the right value.

If you give me exact description of your project structure (related to the issue which I can try) and a minimal module source, I can try it for you, but I don’t have time to figure it out myself right now.

One guess: I don’t know if it matters which directory you are in when you try to execute the command, but you could try to set WORKDIR to the directory from which you would run the command interactively