though not really recommended content in your module files, before importing B you can do it with:
import sys; sys.path.append(your_additional_python_path)
you’ll need to use advice above to turn your dir into a package beforehand.
…though the best approach would be importing your toolA in first place, so both A and B assume that python path is set up correctly in advance; you may also want to move both into a package of some sort, so you can have a reliable namespace for the future. When it comes to setting the path, you could use the sys.path.append() method from script editor once per maya session (I use that for projects I don’t want permanently in my path), or add path to python path permanently via maya.env.
You want to be using the standard python mechanisms to make things available on the path. That’s what they are there for. You could use
import site
site.addsitedir(’/mytool’)
import toolA
import toolB
In general you don’t want to organize your code around tools. What you should be thinking of is function specific modules that are imported into task specific tools
where toolA and toolB import from the files in libs, not from each other. Keep your dependencies simple – you never want to get in the situation where a imports b, b imports c, but c imports a… strange things can happen depending on how the modules are written.
I know masters and geeks have given you the answer but as far my learning experience have taught me to read the docs carefully/ or reread lookem into again if you have forgot or missed, that comes with Python (the docs folder)
also, try dissecting the existing packages that exist to learn.
hmm I guess I was a bit hasty with my reply didn’t read carefully and just assumed it from a first glimps. Anyway I have to vouch for the approach suggested by Theodox for module structure! There is also pth files you can use if you look them up in the documentation for making folders available!