I am trying out the answer in this.
The __init__.py
file in a folder named MyLibs
contains:
LogFile = r'D:\temp'
In utils.py
in the same folder MyLibs
, I tried various ways to access the LogFile
variable:
from __init__ import *
print LogFile #Gives: NameError: name 'LogFile' is not defined`:
and:
import __init__
print MyLibs.LogFile #Gives: NameError: name 'MyLibs' is not defined
I got the errors while executing from MyLibs.utils import *
What is the fix I must do? I prefer a method where I can reference LogFile
directly without having to add namespace prefixes.