<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python imported functions in VRED Forum</title>
    <link>https://forums.autodesk.com/t5/vred-forum/python-imported-functions/m-p/10577865#M2890</link>
    <description>&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have a python script, that imports bare functions from another python file.&amp;nbsp; The file looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;vrKernelServices &lt;SPAN&gt;import &lt;/SPAN&gt;*&lt;BR /&gt;[...]&lt;BR /&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;allToMR&lt;/SPAN&gt;():&lt;BR /&gt;    vrSessionService.sendPython(&lt;SPAN&gt;"MRmode()"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This throws me an error:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;File "[...]VRtools.py", line 173, in allToMR&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;vrSessionService.sendPython("MRmode()")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;TypeError: descriptor 'sendPython' requires a 'vrKernelServices.vrSessionService' object but received a 'str'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Makes no sense to me, because the code is running fine if i do not import it from the file, but run it for example in a variant Set. Also the constructor of 'sendPython' accepts only a str...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
    <pubDate>Fri, 27 Aug 2021 08:31:53 GMT</pubDate>
    <dc:creator>f.grz</dc:creator>
    <dc:date>2021-08-27T08:31:53Z</dc:date>
    <item>
      <title>Python imported functions</title>
      <link>https://forums.autodesk.com/t5/vred-forum/python-imported-functions/m-p/10577865#M2890</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have a python script, that imports bare functions from another python file.&amp;nbsp; The file looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;vrKernelServices &lt;SPAN&gt;import &lt;/SPAN&gt;*&lt;BR /&gt;[...]&lt;BR /&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;allToMR&lt;/SPAN&gt;():&lt;BR /&gt;    vrSessionService.sendPython(&lt;SPAN&gt;"MRmode()"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This throws me an error:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;File "[...]VRtools.py", line 173, in allToMR&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;vrSessionService.sendPython("MRmode()")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;TypeError: descriptor 'sendPython' requires a 'vrKernelServices.vrSessionService' object but received a 'str'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Makes no sense to me, because the code is running fine if i do not import it from the file, but run it for example in a variant Set. Also the constructor of 'sendPython' accepts only a str...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 08:31:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vred-forum/python-imported-functions/m-p/10577865#M2890</guid>
      <dc:creator>f.grz</dc:creator>
      <dc:date>2021-08-27T08:31:53Z</dc:date>
    </item>
    <item>
      <title>Betreff: Python imported functions</title>
      <link>https://forums.autodesk.com/t5/vred-forum/python-imported-functions/m-p/10584003#M2891</link>
      <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you try remove your import&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from vrKernelServices import *&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you import python script via a scriptplugin or a module, importing from vrKernelServices seems to create some weird name clashes in the API. When working with API v2 you do generally not need to import the modules you use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 08:32:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vred-forum/python-imported-functions/m-p/10584003#M2891</guid>
      <dc:creator>chr33z</dc:creator>
      <dc:date>2021-08-30T08:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Python imported functions</title>
      <link>https://forums.autodesk.com/t5/vred-forum/python-imported-functions/m-p/10584595#M2892</link>
      <description>&lt;P&gt;Hmm this magically works - really sounds like a weird nameclash...&lt;/P&gt;&lt;P&gt;I still had to import some functionless enumeratorclasses, which is even more strange.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;vrKernelServices &lt;SPAN&gt;import &lt;/SPAN&gt;vrVRInputDeviceTypes&lt;BR /&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;vrKernelServices &lt;SPAN&gt;import &lt;/SPAN&gt;vrXRealityTypes&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;But it works, so thanks for your help!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 12:59:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vred-forum/python-imported-functions/m-p/10584595#M2892</guid>
      <dc:creator>f.grz</dc:creator>
      <dc:date>2021-08-30T12:59:39Z</dc:date>
    </item>
  </channel>
</rss>

