This Question have 3 answers right now.

How do I import a module from within a Pycharm project?

Question!

In my project, the file structure is as follows:

root/folder1/folder2/script1.py

root/folder1/folder2/script2.py

I have a statement in script2.py that says "import script1", and Pycharm says no module is found. How do I fix this?



Answers

To import as object :

from root.folder1.folder2 import script1

To import a function of your script:

from root.folder1.folder2.script1 import NameOfTheFunction



I think the issue is probably with deleteItem(item); in your item.jsx. You need to say this.props.deleteItem(item);.

Also, in the same method, you are doing e.preventDefault() and e is not even passed. So pass e to your method to use it.

in this line const newState = this.state.items;, you are getting same reference to state instead of returning a new one for mutation as well as using const which is used for constants while you are mutating it in the same method. I would suggest doing let newState = this.state.items.slice(); to get a fresh copy.

in here newState.splice(newState.indexOf(item), 1);, you could assign the index to a variable since you are using it twice in the method.



You need a logical condition in the while. Perhaps

program.toUpperCase().equals("Y")
By : nicomp


Video about How do I import a module from within a Pycharm project?