1

Consider the following directory structure:

lib/
  markov.py
  solver.py
  test.py

markov.py has the following code: super() throwing an error in Sublime Text, works in PyCharm/Terminal

solver.py only contains a bunch of mathematical functions, here's an example of one:

def mm1_busy_idle(arrival, service):
    return round(1 - (arrival / service), 4)

Now, when I try to do import solver in markov.py, PyCharm tells me that there's No module named solver. However, when I do import test it does it just well and I can run the test function from there:

def test():
    print("test!")

Also, when I hover over test.test() PyCharm shows me the following tooltip: Cannot find reference 'test' in '__init__.py'.

My question is: Why can I import test and run the function test() but I can't import solver in markov.py?

Community
  • 1
  • 1
Luke
  • 744
  • 2
  • 7
  • 23

1 Answers1

2

add one file (__init__.py empty file) in lib,

lib/
  __init__.py
  markov.py
  solver.py
  test.py

An ultimate solution:

import sys
sys.path.append("/path/to/lib")
neuront
  • 9,312
  • 5
  • 42
  • 71