-2

I have two directory on same level

1.Scripts->(Inside it we have app.py file)
2. Keymaker-->(Inside it we have keymaker.py file)

Now I want to import keymaker.py in app.py, So how Can I do it

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
  • https://stackoverflow.com/questions/4383571/importing-files-from-different-folder – Cow Jan 04 '22 at 09:04

2 Answers2

-1

Write these lines in app.py file.

import sys
sys.path.append('path/to/Keymaker/dir')

After that you can import anything from keymaker.py file using from keymaker import *

Abhishek Jain
  • 568
  • 2
  • 4
  • 15
-2

Add empty __init__.py file to Keymaker directory and do from Keymaker import keymaker

matszwecja
  • 6,357
  • 2
  • 10
  • 17