You Are Here:

Community: Developer Discussion Boards

#1 Old How to import a variable from a custom module? - 2008-06-28, 01:44

Join Date: Mar 2008
Posts: 57
DrivingMobileInnovation
Offline
Regular Contributor
How to import a variable from a custom module?
Reply With Quote

#2 Old Re: How to import a variable from a custom module? - 2008-06-28, 07:29

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Offline
Forum Nokia Champion
Let's assume you have a custom module named mymodule, with the variable x in it. All you have to do is import the module and make reference to the variable in it:
Code:
import mymodule

new_variable=mymodule.x
Is that what you meant?
Reply With Quote

#3 Old Re: How to import a variable from a custom module? - 2008-06-28, 08:48

Join Date: Feb 2008
Posts: 25
Location: Moscow Russia
Send a message via ICQ to Versoul Send a message via Skype™ to Versoul
Versoul
Offline
Registered User
Still it is possible
Code:
from mymodule import x
or
Code:
from mymodule import x as new_variable
Reply With Quote

#4 Old Re: How to import a variable from a custom module? - 2008-06-30, 19:49

Join Date: Mar 2008
Posts: 57
DrivingMobileInnovation
Offline
Regular Contributor
Thank you. By the way what do you think of that?

main.py

Code:
import mymodule, appuifw
  
a = mymodule.askword()
print a
mymodule.py

Code:
import appuifw

def askword():
    d = appuifw.query(u"Write", "text")
    return d
Last edited by DrivingMobileInnovation : 2008-06-30 at 20:14.
Reply With Quote

#5 Old Re: How to import a variable from a custom module? - 2008-07-01, 04:59

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
hi DrivingMobileInnovation
thats absolutely perfect.
Moreover i have written a wiki article on this have a look.


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Last edited by gaba88 : 2008-07-01 at 05:05.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
How to import a custom module? 9600baud Python 8 2008-06-25 16:37
Error import module akus Python 0 2007-10-21 20:47
problem on running my application rsf Python 7 2007-10-21 16:56
Carbide.j 1.5 and Netbeans 5.5 beta 2 ovjo12 Mobile Java Tools & SDKs 5 2007-06-11 06:43
GoogleIt deepika.mangla General Symbian C++ 4 2007-01-08 02:07

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia