2 years ago

#38056

test-img

solopiu

set python submodule name in setup.py

I have a Python package with this structure:

folder/
    __init__.py
    subfolder_a/
        __init__.py
        module_1.py
        module_2.py
    subfolder_b/
        __init__.py
setup.py

My setup.py is

setup(
    name=folder,
    packages=[folder, folder.subfolder_a, folder.subfolder_b],
)

script_1.py call script_2.py as from subfolder_a import script_2 and I cannot change this code.

Using my code I have an error: ModuleNotFoundError: No module named subfolder_a. Is there a way in setup.py to rename a package?

python

python-3.x

setup.py

0 Answers

Your Answer

Accepted video resources