I have a kind of plugin system, with this layout:
- Python
- SDK
- Plugins
- Plugin1
- Plugin2
- Plugins
- SDK
All 3 have a __init__.py
file. I wonder if is possible to be able to do import SDK
from any plugin (as if SDK
was in the site-packages folder).
I'm in a situation where need to deploy, update, delete, add or change SDK
files or any of the plugins under non-admin accounts, and wonder if I can get SDK
in a clean way (I could sys.path.append
in all plugins but I wonder if exist a better option).
I imagine that using this in the Plugins init coulkd work:
import sys
import os
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),'..'))
print ROOT_DIR
sys.path.append( ROOT_DIR )
But clearly is not executed this code (I imagine __init__.py
was auto-magicalled executed in the load of the module ☹)