DaPhil
DaPhil

Reputation: 1589

How to make python recognize a self-written package?

I created a package (called PyLib) and now, I want to use its content from other script files. I use macOS Catalina and Spyder which came with the Anaconda distribution. I added the absolute path for my package to sys.path: enter image description here

Next, I added an __init__.py (which is empty) to the folder (and some content): enter image description here

To verify if it works, I restarted the kernel (and Spyder, and macOS) but still my package is not recognized: enter image description here

What did I forget to do? What can I do to make python recognize my package?

Upvotes: 0

Views: 60

Answers (1)

rotten
rotten

Reputation: 1630

Try setting your sys.path value one directory higher to the directory that has PyLib in it instead of to PyLib itself.

Upvotes: 3

Related Questions