# Importing a file with definitions [closed]

+1 vote

Happy new year, dear community.

I bother you so early this 2020 with a kind of silly question.

## Question: How to import a file with definitions properly?

### Explanation:

I have on a folder two files, say header.cnb and calculation.cnb. In the header file I keep a lot of definition of expressions and functions, which will be used in calculation.

I try to import the header as (i.e. in the first lines of calculation)

from header import *


And worked! (hurray), but not always. It seems to depend on whether I open cadabra from the application panel or the CLI... or even worst, it depends on the pwd!

Then I try

import sys
sys.path.insert(0,r'/global/path/to/folder')


and worked!... but again, it stop working on a next session.

Even try:

import os


and

import os

import os,sys

closed with the note: The second try works. The issue raise due to a bad code line in header.