I have Python module with single file and single function inside the file. I've uploaded it to pypi, and I used following structure to package it, but when I called the function which it inside module file I received this error:
AttributeError: module 'effInput' has no attribute 'ask'
('ask' is name of function).
Module package structure :
|--effInput
|--__init__. py
|--effInput.py (module file)
|--setup.py
|--readme.txt
|--LICENSE
init.py file:
import effInput
name="EffInput"
What I did wrong?
asked Aug 27, 2018 at 10:18
Basel
1,2831 gold badge13 silver badges27 bronze badges
1 Answer 1
When you do it that way you have to call effInput.effInput.ask instead of effInput.ask. If you did from effInput import * in your __init__.py it should work as intended.
answered Aug 27, 2018 at 10:37
user2653663
2,9481 gold badge20 silver badges23 bronze badges
Sign up to request clarification or add additional context in comments.
2 Comments
Basel
And I should put init.py file in package root or beside module file?
user2653663
Beside module file.
lang-py