So I have a main.py file inside /home/richard/projects/hello-python directory:
import sys
sys.path.append('/home/richard/projects/hello-python')
from Encode import Ffmpeg
x = Ffmpeg()
x.encode()
I have then created a package in the /home/richard/projects/hello-python/Encode directory:
__init__.py
Ffmpeg.py
Init file is empty. Ffmpeg.py file contains:
class Ffmpeg(object):
i = 150
def __init__(self):
print "i am constructor"
def encode(self):
print "hello world"
Now I run the main.py script like this:
python main.py
I get this output:
richard@richard-desktop:~/projects/hello-python$ python main.py
Traceback (most recent call last):
File "main.py", line 5, in <module>
x = Ffmpeg()
TypeError: 'module' object is not callable
richard@richard-desktop:~/projects/hello-python$
I think there is some problem with my sys.path so my module cannot be imported correctly but I am not sure how to fix it.