Search code examples
pythonpypi

Uploading package to PyPi - but can't access any modules?


It's my firs time trying to create and upload my own package. Here it is -> https://pypi.org/project/testeroozz/0.2/#files

The problem is that when I import testeroozz and then run dir(testerooz) on it - I don't see either of: sum_module (the file holding the class), Summation (the class) or great_summation (the method). And so naturally I can't use either of those and get errors of the form:

AttributeError: module 'testeroozz' has no attribute 'sum_module'
AttributeError: module 'testeroozz' has no attribute 'Summation'
AttributeError: module 'testeroozz' has no attribute 'great_summation'

What am I doing wrong?


Solution

  • Import the classes and functions that you want to access in your __init__.py file which is in testeroozz package.

    Your __init__.py file is currently empty.

    It should be:

    __init__.py

    from testeroozz.sum_module import Summation
    
    

    You can refer to this article to learn more on publishing your Python project to PyPI.