0

I have 2 modules: a:

    import another_module
    def func():

b:

    import a
    x=a.func()

This is showing error: module 'a' has no attribute 'func'. What i am doing wrong in importing a.ipynb

  • Try `dir(a)` and see what you get. –  May 18 '20 at 13:13
  • Not enough info for an authoritative answer. What you should do is inspect the content of the imported module `a` after importing it. Do this using `print(dir(a))`. It could be that the module you are importing is not the one you think. – Amitai Irron May 18 '20 at 13:14
  • 1
    You cannot import an `a.ipynb`, when you do `import a` it will import `a.py` or the package under the directory `a/`. – jdehesa May 18 '20 at 13:18

1 Answers1

0

Make sure your module is names 'a.py', and it is in the same folder as b, otherwise, in the place where all the other modules are stored.

Red
  • 26,798
  • 7
  • 36
  • 58