0

I am getting a ModuleNotFoundError: No module named 'webui' when I try to import a class and method from a different directory called webui

So I have a Behave folder which has all my steps and feature files and when I'm trying to import and use a method(ve01_139_UserAuthenticationLevels.run()) from a different class (ve01_139_UserAuthenticationLevels) which is located in a separate folder(webui), please find below the pictures of how I import and try to use the method

enter image description here

Yu Hao
  • 115,525
  • 42
  • 225
  • 281
  • Hi @Nitishmp, please read this [link](https://stackoverflow.com/questions/456481/cant-get-python-to-import-from-a-different-folder) the OP asked a similar question I believe that that you should use the `os path` to access the module and have an `__init__` file in each folder. try searching 'python module not found different directory' for more answers – Modar Na Oct 06 '21 at 16:01
  • @ModarNa i tried adding __init__ file to each folder and tried importing it and i am still getting the same error. I also tried adding this in the init file to make the folder paths absolute and override sys path def get_path(ss): return os.path.join(os.path.dirname(__file__), ss) sys.path += [ get_path('webui'), get_path('regression') ] – Nitishmp Oct 06 '21 at 16:39

0 Answers0