I have my emacs configured with elpy as the following:
;;; for python
(elpy-enable)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode)
(pyenv-mode)
(setq elpy-shell-use-project-root nil)
(setq python-shell-interpreter "python3")
however, when writing a simple python script, if I tried to add a custom python module in the same directory. evaluate in elpy-shell by typing ctrl-c ctrl-c complains that the module is not there.
import restaurant
ImportError: No module named restaurant
if I evaluate the python script directly in the terminal, it works fine. It somehow did not config the elpy shell right, it seems not finding the python module in current directory.
any help is appreciated.
Make out of your
restuarant.pya custom package.quickest way:
copypaste into setup.py:
save it. then
So, now you can locally install using pip from your console python3:
restart python3 from now on, it should be available from everywhere
whenever you put changes into restaurant.py, it should actually be visible immediately. But if not, reinstall with same pip command!
Creating custom package is so easy. I should have began with it long ago to centralize my code and make it available from everywhere.