trouble import in blender text editor


(MarcoPaulo) #1

Hi everybody and sorry for my poor english.

There’s something I dont understand when coding in the text editor inside blender: If I word with 2 files A anB and import B.py in A.py, it doesn’t work. The only way I found is to open the two file in the text editor.
I’ve dont find anything to extend the pythonpath of the python imbeded in blender. It dont use the PYTHONPATH of the operating system.

The same thing in the python console into blender. Can import only the files that are opened in editor.

With two files, it’s not a big trouble, but with dozen it could be irritating.

I’ve tried to copy my files in blender plugin directory (yes, it’s bad :slight_smile: ) or in in the blender python lib directory (yes it’s very very bad. But before finding a solution, desesparated, I’ve tried :slight_smile: ).
In console when import A in the python console, it work, but the import B inside A didnt work (dont find the file).
In editor, when executing A, but the import B inside A didnt work (dont find the file).

Is there something I miss ?


(MarcoPaulo) #2

Pffff, of course it’s possible :slight_smile:
Sorry for that question

in blender console :
import sys
sys.path.appen("…the path to my project source…")