Reputation: 13
So today i started working on a simple python module, but i cant make it work. the module itself works, but when i have uploaded it to PyPI and i then install it using Pip, it wont work. Please notice that it is built for python-2.7 The source code can be seen here:
and it can be downloaded using:
sudo pip install FortyTwo
whenever i try to run a test program like this:
from FortyTwo import *
FortyTwo.nope()
It just gives me an error:
Traceback (most recent call last):
File "test.py", line 3, in
FortyTwo.nope()
AttributeError: 'module' object has no attribute 'fortytwo'
I would really appreciate any help, as it might lead me onto what i have to do to fix the problem.
Upvotes: 1
Views: 220
Reputation: 1178
What if you do
from FortyTwo import fortytwo
fortytwo.nope()
* credits to eandersson.
Upvotes: 1
Reputation: 26362
You would need to do the following.
from FortyTwo import fortytwo
fortytwo.nope()
If you want to call nope directly from FortyTwo you would need to import that function in __init__.py
.
e.g.
from FortyTwo.fortytwo import nope
def Start():
"""No Clue what to add here"""
Upvotes: 1