0

I have a workspace structure like this:

folder
      file1
      file2

I want to import the variables of file1 to file 2. I am using python 3.7.6 on Anaconda Environment.

When I write in file 2

import file1

I get

Error: ModuleNotFoundError: No module named 'file1'

I have tried to save an empty file called __init__.ipynb in the directory but it does not work.

I have tried:

from file1 import #variables

but I get this. Error

Thanks in advance.

Dennis
  • 79
  • 1
  • 8

1 Answers1

0

This should do the trick:

from file1 import YourClass # or your functions, etc.
Adam Boinet
  • 521
  • 8
  • 22
  • Hello Adam, thanks for your quick response. I've tried that but I get this error. Check the screenshot [https://i.stack.imgur.com/qND8m.png] – Dennis Jun 03 '20 at 09:45
  • Check out [this answer](https://stackoverflow.com/a/47558146/8286364). If it works for you, I'll update my answer and flag your question as duplicate. – Adam Boinet Jun 03 '20 at 10:40