Skip to content

Commit

Permalink
Add import in class and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed Sep 24, 2024
1 parent 8f76b42 commit 8a70209
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
18 changes: 17 additions & 1 deletion resources/examples/project1/moduleAtRoot2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
import moduleAtRoot
import moduleAtRoot3

moduleAtRoot2Variable = 42

print(moduleAtRoot.moduleAtRootVariable)
print(moduleAtRoot.moduleAtRootVariable)


class Person:
import moduleAtRoot3
def __init__(self, name, age):
self.name = name
self.age = age

def printInfos(self):
import moduleAtRoot4
if not moduleAtRoot3.moduleAtRootVariable3:
print(self.name + moduleAtRoot4.moduleAtRootSpaceString + str(self.age))

p1 = Person("John", 36)
p1.printInfos()
2 changes: 1 addition & 1 deletion resources/examples/project1/moduleAtRoot3.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
moduleAtRootVariable3 = False
moduleAtRootVariable3 = False
1 change: 1 addition & 0 deletions resources/examples/project1/moduleAtRoot4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
moduleAtRootSpaceString = ' '

0 comments on commit 8a70209

Please sign in to comment.