Calling python script from another directory -


i have python script base.py , having path username/packagename/base.py

another python script application.py, having path username/packagename/bin/application.py

how can call method of application.py base.py, since both being in different folder.

in bin directory, make empty file called __init__.py (two underscores on each side, total of 4 underscores). after doing that, python treat bin python module, , can do:

from bin import application # e.g. application.yourapplicationfunction(params) 

in base.py file.


Comments

Popular posts from this blog

javascript - Trigger mouseenter when an animated element touches mouse -

json - Zend error Connection -

java - Using Spring @Transactional with a combination of readOnly and write, when does this entity get committed? -