0

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?

st4hoo
2,21218 silver badges25 bronze badges
asked Aug 27, 2018 at 10:18
0

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

2 Comments

And I should put init.py file in package root or beside module file?
Beside module file.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.