Import home-made python function in paraview

62 views Asked by At

I wanted to import basic functions in the python shell included in paraview. I tried:

import os
os.chdir('/path/to/my/directory')
import hello_world

Got the result:

Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'hello_world' is not defined

while I have a hello_world.py in the directory …

1

There are 1 answers

0
Utkarsh On BEST ANSWER

Try this instead:

import sys
sys.path.append("/path/to/my/directory")

import hello_world