intra-module dependencies

J

Joey Tsai

Assuming you have two directories of modules:

project/lib
project/filters

How can functions in "filters" reference functions in "lib"? Right now
I have in the files in filters:

sys.path.append( ".." )
import lib

But that's kinda ugly. Section 6.4 in the python tutorial says that if
I'm in the project/filters directory I should be able to access lib
like:
import project.lib

But that doesn't work if I'm running python scripts in the
project/filters directory. Is there any nicer way to do this?

Basically, I have a "main" project file that uses things in both lib and
filters, so normally I don't have this problem, but I want the filters
to be able to run by themselves.

Thanks! Please CC to me, I'm not subscribed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top