0

I would like to embed a script file full of often used defs into other script files. For example, I would like test.py to load the contents of defs.py (which is in the same folder) into itself in line.

When I try adding

import defs

into the body inside test.py I get error "No module named defs"

user2016210
  • 119
  • 4
  • 13

1 Answers1

0

For anybody else facing this issue. Just add this on top of your script:

import sys
sys.path.append(os.path.dirname(__file__))
Ajwad
  • 1
  • 1