1

Pretty new to python. Running linux os

I have a folder folder1 with my main program "main.py"

I have a folder folder2 with my module "module.py"

The module has 2 functions in it function1 and function2

Both folders are in the same folder.

How do I import the module.py from folder2 into my main.py in folder1? or do I have to pick out the individual function from module.py somehow?

preferably just import both functions at once

Alex Mollberg
  • 231
  • 3
  • 5
  • 9

1 Answers1

0

You can do:

import sys, os.path

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
+ '/folder2/')

Then you can import as usual. Please see the answers to a similar question.

Nagev
  • 10,835
  • 4
  • 58
  • 69