I'm writing a simple Python module (called event_classifier
) for a project that I'm currently working on and am having the following issue. There is a text file (categories.txt
) that contains several strings that I need to read using various functions in the module. However, when I import the classes from the module using the following command
from event_classifier import *
I get an error, because the functions open categories.txt
using the relative path to the file within the event_classifier
directory. Thus, when I import the module, the file is not imported with it, so it no longer exists there.
By the way, my __init__.py
file inside event_classifier
just has the following
from Event import *
from alg import *
(it just imports all of the classes and functions from the other files in the module).
Has anyone had this problem before and was able to come up with a working solution?